The idea that Mary did not experience the pains of labor is usually deduced from the fact that she was conceived without original sin (CCC 490-493). Since a consequence of original sin is bearing children in pain (Gen. 3:16), it seems fitting that Mary, who was preserved from the stain of original sin, would not experience its consequences.
The Church teaches that Mary’s virginal integrity remained in tact during the birth of Jesus (CCC 499, citing Lumen Gentium 57). It seems to follow, therefore, that she would have been free of labor pains.
One Scripture passage that many have looked to is Isaiah 66:7: “Before she travailed, she brought forth; before her pain came, she was delivered of a man child.”
For more information, see Tim Staples’ online article “Was Mary Free from Labor Pain?”