What does Matthew 1:19 mean?
While Luke's version of the story of Jesus' birth focuses more closely on Mary's experience, Matthew is describing it from Joseph's perspective. Mary and Joseph were betrothed to be married, something far more formal than a modern engagement. This likely meant Joseph had made an agreement with Mary's father, perhaps years earlier, to take Mary as his wife. The agreement was binding—legally, they were as good as married, other than the wedding ceremony and physically consummating the relationship.The previous verse revealed that Mary was found to be with child "from the Holy Spirit." It's helpful to remember that, at first, the only part of this Joseph knows is that she is pregnant. He would not have known, immediately, about the crucial explanation. He knew only that his almost-wife was pregnant with a child that is not his.
Joseph is said to be "a just man." He may have felt hurt and betrayed, but he did not apparently fly into a rage or wish to hurt Mary, even though all signs pointed to what amounted to adultery in their culture. On the contrary, he seems not to want additional shame for her if he could help it. This seems extraordinarily kind, given the circumstances. Part of this kindness might have been that Mary was likely much younger than Joseph. We don't know that for sure, and marriage arrangements such as this were common, even when there was an age gap. Still that's a possible explanation for why Joseph disappears from the Gospel narratives by the time Jesus is grown.
Compassion did not require Joseph to go through with marrying a seemingly-unfaithful woman. Instead, he was going to divorce her as quietly as possible. He did not intend to make a public issue about why he was breaking off their agreement by legal means. The fact that this required divorce papers shows just how binding a betrothal was in the culture of the day.