Joseph, Mary's husband, is mentioned a few times in the beginning of Matthew and Luke; he is also mentioned one last time in connection with Jesus' childhood visit to the temple (Luke 2:41-52). Very little is written in Scripture concerning Joseph, especially in comparison to Mary. However, the book of Matthew does provide enough information to gain adequate insight into the person of Joseph, Jesus' earthly father:
Now the birth of Jesus Christ was as follows: when His mother Mary had been betrothed to Joseph, before they came together she was found to be with child by the Holy Spirit. And Joseph her husband, being a righteous man and not wanting to disgrace her, planned to send her away secretly. (Matthew 1:18-19)This passage clearly states that Joseph was a righteous man. Joseph was not a hypocrite; he was not cold-hearted. Being a Jew, Joseph must have been familiar with the law of God (the Pentateuch: Genesis, Exodus, Leviticus, Numbers, Deuteronomy). He would have been familiar with Deuteronomy 22, which contains several laws that address the sin of adultery— laws that might have, at first, appeared to apply to his predicament.
The law placed the sentence of death upon the engaged woman and man (not the man the woman is engaged to) who commit adultery (Deuteronomy 22:23-24). If Joseph had simply chosen to ignore the law of God, Matthew would be wrong to label Joseph as a righteous man. If Joseph really believed that Mary had committed adultery, he would have been unjust to not want to disgrace her and to plan to send her away secretly.
Perhaps the more Joseph thought about the matter, the more mysterious it became: Mary was a woman of truth... and she was pregnant. But how? Where was the man? And why... why would she make up a ludicrous story and expect anyone to believe her?
Perhaps after careful consideration, Joseph believed Mary's story. Perhaps he concluded that it would be unacceptable to wed Mary, since she was pregnant, but it would also be wrong to defame her, since her pregnancy was not the result of immorality. Regardless, Matthew seems to indicate that Joseph was still in the process of coming to a decision (understandably), when he was interrupted— and divinely guided to a decision. For Matthew writes: But when he had considered this, behold, an angel of the Lord appeared to him in a dream... (Matthew 1:20).
Joseph, Do Not Be Afraid to Take Mary as Your Wife - Matthew 1:20
Joseph's Obedience and Jesus' Birth - Matthew 1:24-25
The Virgin Birth - Matthew 1:18
Mary's Embarrassing Privilege - Matthew 1:18
Jesus' Purpose: To Save His People From Their Sins (Part 1) - Matthew 1:21