Are Catholics allowed to leave marriage in order to become a monk or nun? In the catholic doctrine, is it allowed to leave a marriage and become a monk or nun? Are there any magisterial documents that treat this topic?

Edit: Are there any options e.g. for a specific application of the Pauline privilege? What about the cases like Nicholas of Flüe?
From Roman Cholij's Priestly celibacy in patristics and in the history of the Church:

Although perhaps strange to our own modern ways of thinking, absolute marital continence was far from unknown or unesteemed in patristic times. Tertullian, himself a married man, informs us in his Catholic period, of lay people who practise continence within marriage «pro cupiditate regni coelestis».11 So do Jerome and Augustine in the following century.12 The rapid growth of monasticism and an attraction to the ascetic life led many couples to renounce their intimacy and to enter a monastery13 or to live in continence within more domestic settings. Church authorities had to intervene decisively when the enthusiasm for continence was deemed excessive and tainted with heretical motives, but at the same time praising those who lived the life of continence for the right motives.14 Four centuries later the Second Nicene Council (787) would still endorse the possibility of monastic vocations for the married.15

The relevant part from the Second Nicene Council (787), Canon 20, reads:

If there are persons who wish to renounce the world and follow the monastic life along with their relatives, the men should go off to a male monastery and their wives enter a female monastery, for God is surely pleased with this.

It would seem 1983 Can. 643 §1.2/ (&quot;The following are admitted to the novitiate invalidly:…a spouse, while the marriage continues to exist;&quot;) or the corresponding 1917 Can. 542 1.° [d] abrogate the Second Nicene Council (787), Canon 20; but, as the commentary on the 1983 Code says,

if a couple mutually agrees to renounce marital rights and relationships in order to seek admission to religious institutes, a dispensation from the Holy See must be sought.


A famous recent example of a married couple separating—with the pope's permission, the husband becoming a priest, the wife becoming a nun, and their biological children going to boarding school—is that of Mother Cornelia Connelly (1809-1879), foundress of the Society of the Holy Child Jesus, a sort of modern-day St. Rita of Cascia. See The Life of Cornelia Connelly (1922) or this video documentary on her.

For a history on this, see Spiritual Marriage: Sexual Abstinence in Medieval Wedlock.
Also, pp. 2-3 of Validity of Virginal Marriage by John Cuthbert Ford, S.J., contains a list of married virgin saints.