"For it is written," namely in Isaiah (54:1) according to the Septuagint. Here is mentioned the prophecy through which is proved, first of all, that the mother referred to is free, and secondly, that she is fruitful. With respect to the first, it should be noted that in a fertile woman there is first sorrow in giving birth, but this is followed by joy in beholding the child: "A woman when she is in labor hath sorrow, because her hour is come; but when she hath brought forth the child, she remembereth no more her anguish for joy that a man is born into the world" (Jn 16:21). But a barren woman ...neither suffers the pangs of birth nor has joy in a child. Again there is a difference between bearing and travailing. For the latter refers to the effort to bear, whereas the former refers to the releasing of the foetus now formed. Therefore the fertile woman experiences pain in travail but joy in bearing; the sterile woman, on the other hand, experiences neither the pain of travail nor the joy of bearing.
But these are the two things which the prophet announces to the barren woman: "Rejoice, thou barren, that bearest not: break forth and cry, thou that travailest not." Herein he speaks of Jerusalem, which he calls free and is signified by the barren Sara. For the Church was barren, namely, the Church Militant, of the Gentiles before their conversion when they offered their sons not to God but to the devil. Hence it is said to Babylon: "Barrenness and widowhood will come upon thee, because of the multitude of thy sorceries" (Is 47:9). The Church Triumphant, too, was barren before the passion of Christ, because to her were born no sons who entered into glory, save in hope. For a mighty engine of war blocked the entrance to Paradise, so that no one might enter. To this barren one he says: "Rejoice thou that bearest not." As if to say: The barren, as has been said, are sorrowful, not because they bear, but because they bear not: "As Anna had her heart full of grief, she prayed to the Lord, shedding many tears" (1 Kg. 1:10). But you shall rejoice in the great number of your children: "Then shall thy heart wonder and be enlarged," i.e., you will show the joy in your soul outwardly (Is 60:5). For there are two things in childbirth: the pain from the rupturing of the membrane enclosing the child in the womb, and the crying from pain. Hence he says, "thou that travailest not," i.e., the Church Militant, that makes no effort to bear through desire, and the Church Triumphant, that does not cry for travail; or because the time for having sons has not yet come, "break forth," i.e., show outwardly the joy you have within and cry with sounds of praise: "Cry, cease not, lift up thy voice like a trumpet" (Is 58:1). These two things, namely, to cry and to break forth, pertain to freedom.—Thus the freedom of the mother is made manifest.
He follows with the fruitfulness: "for many are the children of the desolate, more than of her that hath a husband." But since it was said above that the free Church is signified by Sara, there seems to be some doubt whether Sara was desolate. I answer that she was made desolate by Abraham, as it is said here, not by a divorce but with respect to the work of the flesh. For Abraham resorted to the work of the flesh not for the pleasure but to obtain a child. Therefore when he learned that Sara was barren, he abandoned her; not by forsaking the marriage bed, but by not resorting to her from precisely the time that Sara introduced the bondwoman to him. By this we are given to understand that the Church of the Gentiles was left desolate by Christ, because Christ had not yet come; and that the Church Triumphant was desolate of men, for whom no means of entry was open. Of this desolate woman, i.e., the Church of the Gentiles, there are many children, i.e., "more than of her," namely, the synagogue, "that hath a husband," namely, Moses: "The barren hath borne many: and she that had many children is weakened" (1 Kg. 2:5). And this is due to the coming of the spouse, namely, Christ, by Whom she had been left desolate not by want of love, but because the bearing of children had been delayed.
Source: Commentary on Galatians