(This is a continuation of the notes for Matthew chapter 1.)
Matthew declares that Joseph was a “righteous man” (1:19); he is thus a positive example. (Ancient biographers and historians were concerned with providing moral examples, and Matthew is no exception.) In cases of adultery, divorce was mandatory under Jewish law; Roman law agreed. Joseph has grounds to believe that Mary was unfaithful; the question for him is thus not whether he should divorce Mary, but how he should do so.
By charging her before a judge, Joseph could publicly repudiate her pregnancy; he could reduce his dishonor by shaming her. He could also be certain to recoup any money that he had paid toward the marriage, though her shamed family might have returned that to him anyway. Once a father had given his daughter a dowry, her husband could keep the dowry if she were found unfaithful. Joseph has various possible incentives for divorcing her publicly.
But Joseph, being a righteous man, chose to divorce her privately instead. This means that he would give her a certificate of divorce in front of two or three witnesses, sparing her public shame. Even though he had every reason to believe that Mary had wronged him, and even though he would not marry her, he still cared about her honor.
Ancients took dreams very seriously, but this would be all the more true if someone important delivered a message in the dream. Gentiles told stories of deceased people appearing in dreams, but revelatory dreams in the Bible were normally from God or angels.
Joseph’s obedience to the dream is praiseworthy. Think about what he risked by marrying her, at least if anyone else knew that Mary was pregnant. People would assume that he had gotten her pregnant; Joseph would thus embrace her shame for the rest of his life. Whether or not anyone else knew, Joseph is ready to trust Mary based on what God has shown him. He is ready to follow wherever God leads his life.