Here is what it says in the Ignatius Study Bible:
1:19 just man: Or “righteous man”. The expression highlights Joseph’s moral character in the following narrative (1:18-25). send her away: Two interpretations attempt to explain why Joseph decided to separate from Mary. They give opposite answers to the question: Who did Joseph think was the unworthy partner in the betrothal? (1) The Suspicion Theory. This view holds that Joseph suspected Mary of adultery when he discovered she was pregnant. The troubling news led him to seek a divorce in accordance with Deut 24:1-4, although he wished to do this secretly to avoid subjecting Mary to the rigorous law of Deut 22:23-24, which mandates capital punishment for adulterers. Joseph was a just man inasmuch as he resolved to act (divorce) in accordance with the Mosaic law. This common interpretation suffers from a serious weakness: Joseph’s desire to follow the law for divorce (Deut 24) does not square with his willingness to sidestep the law prescribed for adulterers (Deut 22). A truly righteous man would keep God’s law completely, not selectively. (2) The Reverence Theory. This view holds that Joseph, already informed of the divine miracle within Mary (1:18), considered himself unworthy to be part of God’s work in this unusual situation (cf. Lk 5:8; 7:6). His resolve to separate quietly from Mary is thus viewed as a reverent and discretionary measure to keep secret the mystery within her. Notably, the expression to put her to shame is weaker in Greek than in the translation: it means that Joseph did not wish to “exhibit” Mary in a public way. The angelic announcement in 1:20, then, directs Joseph to set aside pious fears that would lead him away from his vocation to be the legal father of the Davidic Messiah. This view more aptly aligns Joseph’s righteousness with his intentions.