Chapter 1 begins in verses 1-17 with a genealogy of Joseph. Even though Joseph was not the blood father of Jesus, in the sight of man he was raised as Joseph's son and was his heir. Most times rights came through the fathers, so it is imprtant to outline who he was from the world's point of view as he interacted with the world.
The New Testament Semeniary manual states, "Matthew began his testimony with an important family history to show that Jesus was a descendent of Abraham and a descendant of king David. To be a descendant of Abraham was important because God had promised Abraham that his descendants would bless and bring salvation to the whole world (see Genesis 12:2–3; Abraham 2:9–11). To be a descendant of King David was important because the Jews knew that the Messiah would be a literal descendant of David (see Isaiah 11:1–9)."
The book of Ruth gives us some o fthe genealogy as well, which gives a litle more dimension to the importance of these women that we might otherwise miss. “And the women her neighbours gave it a name, saying, There is a son born to Naomi; and they called his name Obed: he is the father of Jesse, the father of David.” ( Ruth 4:17.)
Verse 18 and 20 talk a little about the child being of the Holy Ghost.
Verse 19 talks of the character of Joseph. He thought about the kindest way to resolve the matter with Mary and he was going to put her away privately and not make things public.
Verses 20-23 tell of the vision that he had. He is told that she has done nothing wrong and that it is in fulfillment of prophecy that Jesus would be born of a virgin.
He is commanded to take her to wife and is told what to name the child.
Verse 24 states that after his dream he immediately took Mary to wife.
Verse 25 states that they did not have sex until after the child was born, again fulfilling the prophecy of the virgin birth as well as the virgin conception.