When did the prohibition of marriage for priests in the Catholic church originate?
For those called who have made themselves eunuchs for the sake of the kingdom of heaven, they do so because they have been called to it and the joyfully receive it.
12 For there are eunuchs who have been so from birth, and there are
eunuchs who have been made eunuchs by men, and there are eunuchs who
have made themselves eunuchs for the sake of the kingdom of heaven. He
who is able to receive this, let him receive it.”[a]
a. 19.11-12 Jesus means that a life of continence is to
be chosen only by those who are called to it for the sake of the
kingdom of God.
As others have pointed out, it is a call to continence, of which celibacy is a subset, and the invitation is from the LORD himself, with the LORD himself setting the example.
Answering the question
Please see: [Pope] Francis Speaks, Scalfari Transcribes, Brandmüller Shreds | Sandro Magister, in it, German Cardinal Walter Brandmüller is quoted as writing:
THE PRACTICE OF THE POST-APOSTOLIC CHURCH
The original form of celibacy therefore allowed the priest or bishop to continue his family
life, but not his conjugal life. For this reason as well the
preference was to ordain men who had reached an advanced age.
The fact that all of this can be traced back to ancient and sacred
apostolic traditions is testified to by the works of ecclesiastical
writers like Clement of Alexandria and the north African Tertullian,
who lived in the 2nd-3rd century after Christ. Another witness of the
high consideration bestowed on abstinence among Christians is a series
of edifying tales of the apostles, the apocryphal 'Acts of the
Apostles' composed in the 2nd century and widely read.
In the 3rd century the literary documentation on the abstinence of the
clergy multiplied and became increasingly explicit, especially in the
East. For example, here is a passage from the Syrian 'Didascalia':
"The bishop, before he is ordained, must be put to the test to
establish if he is chaste and has raised his children in the fear of
God." The great theologian Origen of Alexandria (3rd century) also
recognized the celibacy of abstinence as binding; a celibacy that he
explains and explores theologically in various works. And obviously
there are other documents that could be brought forward in support,
something that obviously is not possible here.
THE FIRST LAW ON CELIBACY
It was the Council of Elvira in 305-306 that put this practice of apostolic origin into the form of a law. With canon 33, the Council
prohibited bishops, priests, deacons, and all other clergy from having
conjugal relations with their wives, and likewise prohibited them from
having children. At the time it was therefore thought that conjugal
abstinence was compatible with family life. Thus even the sainted pope
Leo I, called Leo the Great, wrote around 450 that ordained men did
not have to repudiate their wives. They were to remain together with
them, but as if "they did not have them," as Paul writes in the first
letter to the Corinthians (7:29).
It should be noted that while these kind of questions always point to the fact that Peter was married, they fail to record that it is the constant Tradition of the Church that St. John the Apostle and Evangelist was never married. Nor can the say whether as married, Peter continued with his conjugal life after a certain point after following Jesus.
And there is Jesus.
Cardinal Brandmüller ends by writing:
[I]t must be taken into account that celibacy, just like virginity in
the name of the Kingdom of Heaven, will always be troublesome for
those who have a secularized conception of life. But as Jesus said in
this regard: “He who is able to receive this, let him receive it.”
It is said that among those who understand and appreciate continency for the sake of the Kingdom, are the married who strive for holiness in their vocation, and vice versa, it is the saintly priests among those who understand and appreciate the calling to sacramental matrimony.
Please see also: