As for the woman, there are 2 senses that can be interpreted, one is of Mary, and the other is the Church. Here are the footnotes from the Aquinas Study Bible for both senses, these are direct quotes from the Fathers and Doctors of the Church.
Mary Interpretation****12:2 cried travailing in birth: That is, at the moment of the Passion, she cried through sympathy. Travailing, that is, like being in the condition of a woman in labor when He was being martyred on the Cross, as Luke 2:35 says, ‘And your own soul a sword shall pierce.’ (St. Albert the Great) Gregory of Nyssa, who talks about the Lord in his Homily on Songs 13, says, ‘Jesus, whose conception is without intercourse, and whose birth is undefiled.’ Therefore the birth was free from pain. If such a great teacher of the Church says this, and the Virgin has escaped the pain of giving birth, how is it that she is travailing? Does this contradict what was said? Not at all… Until the divine angel told Joseph about her, that she conceived of the Holy Spirit, the Virgin was naturally disheartened, and embarrassed before her betrothed, and thinking that he might somehow suspect that she was in labor from a secret relationship. Therefore the text says, under the rule of metaphor, ‘cried travailing.’ (Oecumenius) And she cries out, with wonder, saying: ‘How shall this be, seeing I know not man?’ Travailing in birth, that is to say, when she obeyed, it was without prejudice and with all virginity. Travailing, that is, submitting anxiously, preserving her virginity. (Hugh of St. Cher)
in pain: That was her burning desire to have His pain end while He was suffering. (St. Albert the Great) Or she suffers because the “ancient serpent” wishes to devour “the child”. (Pope John Paul II MULIERIS DIGNITATEM 30) Or, that is, by fasting, by vigils and prayers, abstinence, continence, and anything else of this kind of chastity. (Hugh of St. Cher)
Church Interpretation****12:2 cried travailing in birth: The children of the Church will increase throughout the nations. (Bulus al-Bushi) Or by which is meant that the Church, always bringing forth Christ, becomes the instructor of all the nations. (St. Hippolytus of Rome) Likewise, the doctrine of preaching, which disposes men, that they may become the sons of God by adoption… He says, then, and being with child (in the womb), according to a Gloss, ‘in the memory of the yoke, having, the Word of God.’ This is the fetus, which the Church has received from her Spouse, about which He endeavors to form the children, beautiful and the new… She cried, that is, the preachers in the Church and the good pastors. The Church preaches greater by preaching with passion, which is understood to be with a shout, as Isaiah 58:1 says, ‘Cry, cease not, lift up thy voice like a trumpet.’ Travailing, that is, with an effort attempting to bring forth spiritual children. (St. Thomas Aquinas)
in pain: In pain, the interior desire, and the exterior mortification of the flesh, that she may bear, that is, the spiritual children of God. (St. Thomas Aquinas) Or it means that the Church will not cease to bear from her heart the Word that is persecuted by the unbelieving in the world. (St. Hippolytus of Rome) She called to God, so He would quickly give to her a Son who would free her from the oppression of the infidels. (Nicholas of Lyra)