We have retained verse 18 to understand the unfolding of the scene (4) better. The revelations given to Joseph differ from those given to Mary or Zechariah. Without physically meeting a messenger, Joseph receives his instructions through dreams in which an angel conveys God's messages. Apparently, God adapts his communication to the individual's temperament.
Unlike Mary, Joseph needs the angel to explain his message and remind him of Scripture, particularly Isaiah's prophecies. Joseph seems to find it harder to accept this situation.
Mary, in her third month of pregnancy, risks if Joseph formally ends their relationship. A decision is urgent, since her pregnancy will become evident when she returns to Nazareth.
By welcoming Mary into his home, Joseph publicly declares her innocence and assumes the role of father, thus protecting Mary and the child.
Matthew, who alone mentions these details, knows Jewish law thoroughly. For him and the Jewish audience he addresses, these explanations seem indispensable.
He reveals intimate information about the couple: Joseph had no marital relations with Mary before the birth of their firstborn. It was probably Mary who shared these personal details, known only to the two of them.
The disclosure of this information after the deaths of Joseph and Jesus the Messiah had an impact comparable to a tsunami. These details had never been mentioned in Jesus' teachings. Mary realises that the mystery of Jesus' birth cannot remain hidden and that revealing the truth is essential.
She first confides in the apostles shortly after Pentecost in the year 33, and later in Luke. For a long time, Joseph was regarded as Jesus' father (Luke 2.23), but rumours emerged following these revelations. An unfounded tradition suggests, without evidence, an adulterous affair with a officer who was supposedly Jesus' biological father. We can imagine the rumours of the time.
In revealing the truth about Jesus' birth, Mary would never have imagined unleashing such a flood of slander.