Because Joseph her husband was faithful to the law, and yet did not want to expose her to public disgrace, he had in mind to divorce her quietly. But after he had considered this, an angel of the Lord appeared to him in a dream and said, “Joseph son of David, do not be afraid to take Mary home as your wife, because what is conceived in her is from the Holy Spirit.I gave Joseph a lot of credit on Day 1 for his willingness to be part of this seemingly scandalous birth.
Seriously, what a brave guy. What an example of faith and loyalty. Before he knew that this was anything more than his betrothed having an affair, he was willing to protect her from shame.
Joseph was protective of Mary.
Once the angel appeared to him, he showed his loyalty.
The conversation with the angel could have gone something like this:
"Joseph, do not be afraid to take Mary as your wife."
"Um, I didn't get her pregnant. I'm a good guy and I don't want people to think I did this!"
"What is conceived in her is from the Holy Spirit."
"Mr. Angel, I'm not sure if you know this, but the Holy Spirit does not go around impregnating young unmarried women. I'll just quietly go away and her family can handle this."
But that isn't how it went. After some prayerful turmoil, I'd assume, Joseph took his commitment to Mary seriously and took care of this women and her growing baby. He became the earthly father of God's son. The ultimate Step-Dad!
Joseph was loyal to Mary.