Joseph responded to the angel’s explanation of Mary’s pregnancy by marrying her, as the angel had instructed (Matthew 1:24–25). When commanded to leave Bethlehem to flee to Egypt, he "got up, took the child and his mother during the night and left for Egypt” (Matthew 2:14). When told to return to Israel, he returned, despite apparent misgivings about the safety of the return (Matthew 2:19–23). Joseph, like Mary in Luke’s gospel, responded with immediate submission and obedience to the command of the angel of the Lord.
19 And her husband Joseph, being a just man and unwilling to put her to shame, resolved to divorce her quietly.