In the OT, it was not uncommon for mothers to vow there children to a life to God.
1 Samuel 1:
10 In her bitterness she prayed to the LORD, weeping copiously, 11 and she made a vow, promising: "O LORD of hosts, if you look with pity on the misery of your handmaid, if you remember me and do not forget me, if you give your handmaid a male child, I will give him to the LORD for as long as he lives; neither wine nor liquor shall he drink, and no razor shall ever touch his head."
St. Anne (Mary's Mother) did just that for her daughter. Mary was then to serve the Lord at the Temple, as women had for centuries (1 Sam. 2:22). A life of continual, devoted service to the Lord at the Temple meant that Mary would not be able to live the ordinary life of a child-rearing mother. Rather, she was vowed to a life of perpetual virginity.
Catholic Answers goes on to note,
However, due to considerations of ceremonial cleanliness, it was eventually necessary for Mary, a consecrated "virgin of the Lord," to have a guardian or protector who would respect her vow of virginity. Thus, according to the Protoevangelium, Joseph, an elderly widower who already had children, was chosen to be her spouse. (This would also explain why Joseph was apparently dead by the time of Jesus adult ministry, since he does not appear during it in the gospels, and since Mary is entrusted to John, rather than to her husband Joseph, at the crucifixion).
So it's not far fetched that Mary would remain a virgin. You can almost see her as one of the early forms of nuns.