Here is how Matthew relates it...
The birth of Jesus Christ came about this way: After His mother Mary had been engaged to Joseph, it was discovered before they came together that she was pregnant by the Holy Spirit. So her husband Joseph, being a righteous man, and not wanting to disgrace her publicly, decided to divorce her secretly.
But after he had considered these things, an angel of the Lord suddenly appeared to him in a dream, saying, “Joseph, son of David, don’t be afraid to take Mary as your wife, because what has been conceived in her is by the Holy Spirit. She will give birth to a son, and you are to name Him Jesus, because He will save His people from their sins.”
Now all this took place to fulfill what was spoken by the Lord through the prophet:
See, the virgin will become pregnant and give birth to a son, and they will name Him Immanuel, which is translated “God is with us.”
When Joseph got up from sleeping, he did as the Lord’s angel had commanded him. He married her but did not know her intimately until she gave birth to a son. And he named Him Jesus.
Matthew's account focuses on the human man/husband/father in the story. Joseph was going to have a rough time of it. So God sent an angel... a messenger to him to reassure him that this event was of God.
God sends us messengers to help us in our life as well. It may not be as dramatic as having an angel show up at the foot of your bed, but it shows that God is in the middle of your situation. Value the messengers God puts in your life.
[Bible quotes are from the Holman Christian Standard Bible, unless otherwise noted.]
Find more of David’s work at Heart Of Ministry.