‘…On the one hand, Joseph is a sensitive man who does not wish to shame Mary; on the other hand, honor, so important in this culture, virtually would require that he look for a more faithful potential wife.
He wished to spare her a shameful public trial. His preference was to do something quietly.
These details tell us something of the character of Joseph and are part of the Matthean narrative portrayal of him.
Joseph’s plans are stopped by a dream. This is one of several such direct interventions in these two chapters (2:12, 19, 22). God is at work in these events to lead and to guide. An unnamed angel instructs Joseph to take Mary as his wife.
The explanation is that she has conceived ‘by the Holy Spirit’. Joseph is addressed explicitly as the son of David, highlighting the Davidic theme already mentioned in the genealogy.’ p.64.
‘Here is one place where Matthew and Luke overlap. They both have Jesus going to Nazareth. However, there is a significant difference. Luke describes a return to Nazareth, while Matthew appears to have Joseph contemplating a return to Judea, and he is stopped only when a dream causes him to “withdraw to the district of Galilee” because Archelaus is chosen to rule after his father, Herod.
Joseph had reason to be nervous about Archelaus. Secular history confirms that many Jews did not want Archelaus to rule over Judea. Nonetheless, he was given the demoted role of ethnarch, in comparison to his father, the king. He was seen as a cruel and incompetent leader who eventually was removed from office in A.D. 6.
Once again, it is God’s direction and protection through a dream that is noted as the driving factor in the action. Joseph’s withdrawal to Nazareth leads to the final Old Testament citation by Matthew in the infancy material (2:23).
Still, the mention of Nazareth is important regardless of how this is the point of the citation. The Jewish view was that nothing good comes from there (John 1:46), but God is full of surprises.’
Jesus according to Scripture, Darrell L Bock, Baker Academic, 2002, p.73