The passage you are referring to is Rev 12:1-2. It reads as follows:
1 And a great portent appeared in heaven, a woman clothed with the sun, with the moon under her feet, and on her head a crown of twelve stars; 2 she was with child and she cried out in her pangs of birth, in anguish for delivery.Now, we have to remember that the Book of Revelation is full of symbols that have many layers of meaning. The woman from Rev 12 is representative of Mary, Israel, and the Church. Sometimes only one of the three is evoked, other times all three are present. The meaning of symbols in apocalyptic literature is often very fluid in this way.
So, we have a woman experiencing the pangs of child birth. In one sense, this woman is Mary. After all, she gives birth to a son who will rule all the nations (vs. 5) and is the mother of all Christians (vs. 17). But, since Mary did not receive the stain of original sin, she could not have experienced pain when Jesus was born. Therefore, this pain must refer to something else.
I think the pain and anguish we read about here is spiritual, not physical. After all, when Mary and Joseph brought the baby Jesus to Simeon, he prophesied that a sword would pierce her heart because of her son (cf. Lk 2:34-35). Jesus’ Passion and Death are the source of this pain. She suffered bitterly at the foot of the Cross as her Son hung there alone and dying.
Of course, like I said, this woman can also represent Israel. In this case, the pangs of childbirth symbolize the great suffering and longing that the Israelites experienced in their exile. Isaiah said Israel was “like a woman with child, who writhes and cries out in her pangs, when she is near her time” (Isa 26:16-18). The prophet Micah uses this same analogy: “Writhe and groan, O daughter of Zion, like a woman in travail; for now you shall go forth from the city and dwell in the open country; you shall go to Babylon” (Micah 4:10).
As the Church, we experience this same suffering and longing as we await the Second Coming. Paul told the Galatians that he was “in travail” until Christ be formed in them (4:19). According to him, “the whole of creation has been groaning in travail” and “we ourselves … as we wait for adoption as sons, the redemption of our bodies” (Rom 8:22-23).