The earliest canon law mandating clerical celibacy comes from the 4th century. Priestly ‘continence’ (i.e. abstinence from sex) was highly regarded by early church fathers such as St Paul, Augustine and Ambrose; and a reverence for chastity is undeniably present in the New Testament (think Virgin Mary). However, the Catholic Church after the fall of the Roman Empire was scattered, impoverished and parochial. Standards had slipped and priestly concubines were widespread and accepted.
Things start to get interesting in the 11th century. The church reform movement of this era is quite complex to navigate: but basically it began in the monasteries before branching into diocesan and papal reform, with the goal of better organising the church, setting stricter, more ascetic ideals and seeking to place the clerical order above the laity. One potent means of highlighting the superiority of the clerical order was to claim sexual purity, and church reformers rallied against ‘nicholaitism’ (clerical marriage). Important reforming figures include St Bernard of Clairvaux and Peter Damian; these men had an almost pathological aversion to sex. Peter Damian described women as ‘Devil’s choice tidbits, expulsion from paradise, virus of minds, sword of souls, wolfbane to drinkers, poison to companions, material of sinning, occasion of death’ (quoted from Dyan Elliot, Spiritual Marriage: Sexual Abstinence in Medieval Wedlock).
Peter Damian moved in the same circles in Rome as the monk Hildebrand, later Pope Gregory VII, a man intent on setting up a papal monarchy to the detriment of kings, and a radical reformer who emphasized the godliness of using violence in the name of the church. In a letter to the south German dukes of January 1075 (who Gregory VII supported in their rebellion against the emperor Henry IV), Gregory beseeches them to act against married priests: “to the utmost of your power you are to prevent such men from administering the sacred mysteries, even, if necessary, by violence”. According to Sigebert of Gembloux, Gregory had “brought downs the swords of laymen on the necks of the clergy”. Mutilation was a popular tactic against married priests, as mutilation debarred a man from carrying out priestly office. Gregory VII was known as the pope of the Patarini. The Patarini were a mob of reforming ascetics in Milan, led by the knight Herlembald and his band of mercenaries, who wore coarse hair shirts while dragging married priests from the altar.
The issue of clerical marriage in this period is intriguing because of how entwined it is with power, violence and emerging notions of ‘holy war’. Herlembald has been named by the historian C. Erdmann as the ‘first crusader’. Pope Gregory VII lauded Herlembald’s “pious solicitude in defence of the faith”, regarding him as a most ‘energetic knight of Christ’. He even sent him the papal banner. Those assembled to hear Urban II preach the First Crusade at Clermont in 1095 would likely also have heard his condemnation of married clergy, for the first canon of the council of Clermont barred any married priest from celebrating the Mass.
The reform movement definitely eradicated many married priests. However, if you were to ask Martin Luther or John Calvin, priestly concubines still existed, proving that clerical celibacy was an unsustainable way of life.
Edit: this period of history can be quite heavy to get through, particularly since there's so much theology involved. I would suggest anything by Christopher Brooke as a good introduction.
And Paul does not hesitate, in one of his epistles, to greet his wife Clement of Alexandria, Stromata).