Matthew writes that this is how the birth of Jesus took place. “Now the birth of Jesus Christ took place in this way. When his mother Mary had been betrothed to Joseph, before they came together she was found to be with child from the Holy Spirit” (Matt. 1:18). Betrothal happens one year before marriage. In Jewish law, betrothal is more binding than an engagement. If you are betrothed, you are called a husband. To break a betrothal, you file a divorce.
Here is the bad news for Joseph. Long before Joseph touched her, Mary was already pregnant. The worst thing is that this baby is not his baby!
Joseph could not accept Mary as his betrothed wife. In Deut. 22:23-24, a betrothed woman caught in adultery shall receive the death penalty.
If there is a betrothed virgin, and a man meets her in the city and lies with her, then you shall bring them both out to the gate of that city, and you shall stone them to death with stones, the young woman because she did not cry for help though she was in the city, and the man because he violated his neighbor’s wife. So you shall purge the evil from your midst (Deut. 22:23-24).
That is the law of the Lord. You see, God wants you to reserve sex until you get married. You should not touch each other before you get married.
God’s Word calls Joseph a “just man,” a righteous man. (READ v. 19) He was a man who obeyed the law of Moses faithfully. Joseph was probably around 18 or 20 years old at this time. But he obeyed God as a young man.
Guys listen! Being a just man, Joseph did not touch Mary. You should not also touch your girlfriend, who is not yet your wife. The right thing to do is to not touch a girl. Follow the example of Joseph. Do not have sex with a girl who is not your wife. That is the law of the Lord. If you do not touch a girl, you are a just man, a righteous man. If you honor God by obeying His law, God shall honor you.
But Mary is now pregnant. Hence, Joseph suspected that Mary must have committed adultery. Joseph knew that under the law, Mary can no longer marry him. Joseph must divorce her. His decision was not out of anger, but out of obedience to God.
Also, Matthew says that Joseph was “unwilling to put her to shame.” “And her husband Joseph, being a just man and unwilling to put her to shame, resolved to divorce her quietly” (Matt. 1:19). I looked into the word, “unwilling” (Gk. thelo). It means, “wish, desire, want.” (Gingrich) Joseph was not wishing to shame Mary for her pregnancy. Mary will be accused of adultery. Mary will be shamed before society. Mary will be scandalized. Joseph did not want that to happen to Mary. So Joseph resolved to divorce her “quietly” (v. 19). The adverb, “quietly” (Gk. lathra) means, “secretly.” (Gingrich)
But, and there’s a big “but” in v. 20.
But as he considered these things, behold, an angel of the Lord appeared to him in a dream, saying, “Joseph, son of David, do not fear to take Mary as your wife, for that which is conceived in her is from the Holy Spirit. She will bear a son, and you shall call his name Jesus, for he will save his people from their sins” (Matt. 1:20-21).
Joseph was still thinking about how Mary got pregnant, how he did not want to shame her, and about his plan to divorce her. He was thinking these things until he fell asleep. While sleeping, he had a dream. In that dream, an angel appeared to him. In the middle of Joseph’s troubled thoughts, God sent an angel.
Brothers and sisters, you might be in the middle of a big problem. You might be in the middle of a big confusion. You might be in the middle of a big challenge. But in the middle of it, God is there. In the middle of it, God shall come in. He will guide you to make the right decision.
What did the angel tell Joseph? “Joseph, son of David, do not fear to take Mary as your wife” (Matt. 1:20). Joseph, don’t be afraid, for the baby is from the Holy Spirit.
What are you afraid of today? Are you afraid of something that you do not understand? Are you afraid of something that might happen to you? Are you afraid of something that might destroy you? Brothers and sisters, that might be something from God. God shall see you through.
Then the angel said in v. 21, “You, Joseph, shall have a big role. You shall call his name, Jesus.” Notice that it is God who called Joseph. It is God who gave the name, Jesus, to Joseph. In vv. 24-25, we find that Joseph obeyed God. By this act of Joseph, Jesus is placed in the family line of David.
Then in v. 22, Matthew says that it all took place to fulfill prophecy. “All this took place to fulfill what the Lord had spoken by the prophet: ‘Behold, the virgin shall conceive and bear a son, and they shall call his name Immanuel’” (Matt. 1:22-23). Who then is Jesus Christ? Jesus Christ is the true Messiah by a miraculous act of God. Jesus Christ is the true Savior in fulfillment of the OT prophecy.
 Leon Morris, The Gospel According to Matthew (PNTC; ed. D. A. Carson; Grand Rapids: Eerdmans, 1992), 28.