It says clearly in Matthew that although Joseph was troubled when his affianced wife, Mary, was found to be with child of the Holy Spirit before they had come together, he took her as his wife after he received a message from an angel.
Joseph saved Mary, to whom he was publicly engaged, from sorrow, shame, and abandonment by doing what the angel said: “Joseph, son of David, do not fear to take Mary your wife, for that which is conceived in her is of the Holy Spirit.” He got his angelic Annunciation as well as Mary, and he too believed and obeyed in faith.
Matthew adds that Joseph did not know her until the child was born; the angel had quoted the prophecy of Isaiah to him and he knew what not to do, presumably. “A virgin shall conceive and bear a son.” Not just the conception but the bearing was by a virgin (the Septuagint uses parthenos unambiguously to translate the Hebrew almah in Isaiah).
So Mary was still a virgin at the time of the birth, but she was a married woman with a husband standing by her when Jesus was born. There was no stigma for her as an unwed mother, no matter what countless well-meaning preachers say in their Christmas sermons.
The Roman Catholic Church teaches that Mary was ever-virgin, but that her perpetual virginity does not mean that she and Joseph were not really married. It was a valid marriage, presumably, even if never consummated. Maybe that was the way it was, but we’ll never have any evidence other than what the gospels say. Mark 6:5 and Matthew 13:55-56 speak of Jesus having four brothers and at least two sisters, which seems more in line with Mary’s spiritual ancestor Hannah, who had three more sons and two daughters after dedicating Samuel to the Lord (1 Sam. 2:21). James, “the brother of the Lord” and the leader of the church in Jerusalem, is a major figure in Acts and is the only apostle referred to in that way.
I believe Luke does not contradict Matthew when he calls Mary the “espoused wife” of Joseph in the account of their traveling to Bethlehem per Augustus Caesar’s edict. Rather, Luke is asserting Mary’s virginity even as he calls her Joseph’s wife. They had committed themselves to each other as engaged couples do, and Joseph had taken her as his wife per Matthew, but, since a marriage is not consummated until sexual intercourse has taken place, Luke uses espoused as a way of saying there has been no consummating intercourse between them.
Traditionally, a lack of consummation is grounds for annulment if one party desires it; the marriage can be judged to have never taken place no matter what has been vowed and signed.
In that time, once a man took his betrothed into his household, they were married in the eyes of the world. The two of them know that she is still a virgin and know why and how. There is no shame involved in her position; they go to Bethlehem together, husband and wife, knowing that her time to give birth is coming soon, and trusting God’s call to each of them to undertake this together.
The emphasis on Mary’s “unwed” motherhood in recent years is perhaps a commendable attempt to sympathize with women in every time and place who are in that position. But I believe a careful reading of the two Gospel accounts of Jesus’ birth teaches otherwise. Actually the Gospels give Joseph the honor he deserves for obeying God in faith, taking pregnant Mary as his wife, giving his name to the child she is carrying, continuing to heed angelic messages to protect them from Herod’s murderous intentions, and raising Jesus as his own, just as any adoptive father does.
I think it is very important, especially today, to emphasize that Jesus was born into a family, with a human father and mother. Many traditional Christmas carols like “Joseph dearest, Joseph mine” honor Joseph’s role in the birth of the Savior. We also should honor him by realizing that Mary did not give birth alone, unprotected, or unloved, but rather as a wife of a husband who also had answered God’s call and knew that, whatever commitments he made, he was doing God’s will along with her, his chosen wife.