Joseph and Mary were not yet married, when Joseph was shocked to learn that Mary was pregnant. Since Mary had been promised to him in marriage, Joseph had the right, according to Jewish custom, to report the matter to the authorities and have Mary dealt with for marital unfaithfulness. Joseph was a morally upright man but he was also compassionate. Instead of acting spitefully towards Mary, he tried to protect her from public shame by breaking the engagement secretly. God then intervened to show Joseph that Mary’s pregnancy was miraculous, pure and of the Holy Spirit. The son to be born to her would be Israel’s long-awaited Messiah, whose mission was not to save his people from foreign domination but to save them from sin (Matt 1:18-21).
Being a person of faith, Joseph believed God. He took Mary as his wife, though he had no sexual relations with her before the birth of Jesus (Matt 1:22-25).