Mary’s perpetual virginity is a de fide dogma of the Catholic faith (see the revised version of Fundamentals of Catholic Dogma by Ludwig Ott; Baronius Press, 2018; edited by Robert Fastiggi, p. 222).
It was defined at the 2nd Council of Constantinople in 553 (Denzinger 214, 218, 227), at the Lateran Synod of 649 (Denzinger 256), and by a proclamation of Pope Paul IV in 1555 (Denzinger 993). The Catholic Encyclopedia (“Virginity”) states:
Physically, it implies a bodily integrity, visible evidence of which exists only in women. The Catholic Faith teaches us that God miraculously preserved this bodily integrity, in the Blessed Virgin Mary, even during and after her childbirth.
The Church fathers saw biblical evidence and substantiation of this doctrine primarily in the three following Old Testament passages:
Song of Solomon 4:12 (RSV) A garden locked is my sister, my bride, a garden locked, a fountain sealed.
Though she is His mother, she is a virgin still. For Jesus has entered in through the closed doors, John 20:19 and in His sepulchre — a new one hewn out of the hardest rock — no man is laid either before Him or after Him. John 19:41 Mary is a garden enclosed...a fountain sealed, Song of Songs 4:12 . . . (St. Jerome, Epistle 48:21; to Pammachius)
Isaiah 66:7 “Before she was in labor she gave birth; before her pain came upon her she was delivered of a son.”
His birth was in accordance with the laws of parturition, while in that it was painless it was above the laws of generation. For, as pleasure did not precede it, pain did not follow it, according to the prophet who says, Before she travailed, she brought forth, and again, before her pain came she was delivered of a man-child. Isaiah 66:7 . . . But just as He who was conceived kept her who conceived still virgin, in like manner also He who was born preserved her virginity intact, only passing through her and keeping her closed. Ezekiel 44:2 The conception, indeed, was through the sense of hearing, but the birth through the usual path by which children come, although some tell tales of His birth through the side of the Mother of God. For it was not impossible for Him to have come by this gate, without injuring her seal in any way. (St. John Damascene, An Exposition of the Orthodox Faith, IV: 14)
Ezekiel 44:2 And he said to me, “This gate shall remain shut; it shall not be opened, and no one shall enter by it; for the LORD, the God of Israel, has entered by it; therefore it shall remain shut.”
She is the east gate, spoken of by the prophet Ezekiel, always shut and always shining, and either concealing or revealing the Holy of Holies; and through her the Sun of Righteousness, Malachi 4:2 our high priest after the order of Melchizedek, Hebrews 5:10 goes in and out. Let my critics explain to me how Jesus can have entered in through closed doors when He allowed His hands and His side to be handled, and showed that He had bones and flesh, . . . , and I will explain how the holy Mary can be at once a mother and a virgin. A mother before she was wedded, she remained a virgin after bearing her son. (St. Jerome, ibid.)
Who is this gate (Ezekiel 44:1-4), if not Mary? Is it not closed because she is a virgin? Mary is the gate through which Christ entered this world, when He was brought forth in the virginal birth and the manner of His birth did not break the seals of virginity.... There is a gate of the womb, although it is not always closed; indeed only one was able to remain closed, that through which the One born of the Virgin came forth without the loss of genital intactness. (St. Ambrose, The Consecration of a Virgin and the Perpetual Virginity of Mary, 8:52)
General patristic statements on Mary’s in partu virginity follow:
Of Him then His mother's burden was light, the birth immaculate, the delivery without pain, . . . nor brought to pass with sorrow. For as she who by her guilt engrafted death into our nature, was condemned to bring forth in trouble, it was meet that she who brought life into the world should accomplish her delivery with joy. (St Gregory of Nyssa, Homily on the Nativity)
(Christ) transcends, indeed, the miracles of all besides, in being born of a virgin, and in possessing alone the power, both in His conception and birth, to preserve inviolate the integrity of His mother . . . (St. Augustine, Tractate 91:3)
Jesus Christ, . . . was born, while his mother's virginity remained intact: for the Virgin remained such in bearing him just as she had in conceiving him. (Pope Pelagius I, Letter to King Childebert I)
St. Thomas Aquinas also concurred:
In order to show that body to be the body of the very Word of God, it was fitting that it should be born of a virgin incorrupt. Whence in the sermon of the Council of Ephesus (quoted above) we read: "Whosoever brings forth mere flesh, ceases to be a virgin. But since she gave birth to the Word made flesh, God sa***uarded her virginity so as to manifest His Word, by which Word He thus manifested Himself: for neither does our word, when brought forth, corrupt the mind; nor does God, the substantial Word, deigning to be born, destroy virginity. . . . We must therefore say that all these things took place miraculously by Divine power. Whence Augustine says (Sup. Joan. Tract. 121): "To the substance of a body in which was the Godhead closed doors were no obstacle. For truly He had power to enter in by doors not open, in Whose Birth His Mother's virginity remained inviolate." (Summa Theologica, 3rd Part, Q. 28, a. 2)
“Mary ‘remained a virgin in conceiving her Son, a virgin in giving birth to him, a virgin in carrying him, a virgin in nursing him at her breast, always a virgin.’ With her whole being she is ‘the handmaid of the Lord.’’ (CCC 510)