Revelation 12:2 follows the pattern of multiple meanings in the images observed by John throughout the book of Revelation. The woman clothed with sun has three levels of meaning. On one level it refers to the blessed virgin Mary, on another it refers to Israel, and on yet another it refers to the Church. It is for this reason that some of the content of Revelation 12 may seem problematic if we attempt to apply all of it to Mary. The same holds true when we apply it “all” to Israel, or when we apply it “all” to the Church.
This is one of the beautiful things about scripture. It has tremendous depth and it can be studied from many different angles to reveal many facets of God’s plan of salvation. This is especially true in apocalyptic writings. Try reading Chapter 12 with the woman representing each of the given layers. Consider the woman as representing Mary, and then go back and read it as if the woman represents Israel, and then finally as the Church.
The phrase concerning birth pangs may not apply to Mary but to Israel or the Church. Or it may indeed apply to Mary, but on a different level then physical pain. Afterall, she knew that she was going to give birth to the Messiah and probably knew from OT prophecy what this would mean for him. A mother would certainly agonize over the prospects of what would happen to her son.