"But while he thought on these things, behold, the angel of the Lord appeared unto him in a dream, saying, Joseph, thou son of David, fear not to take unto thee Mary thy wife: for that which is conceived in her is of the Holy Ghost" (Matthew 1:20).
Joseph's presence at Christ's birth witnesses to his triumph over the severe test that had befallen him. Mary was the pure young woman he was about to make his wife. But when it was evident that she was "with child" (Matthew 1:18), Joseph determined to leave her. But he waited upon God, and his love for and patience with Mary were rewarded with a direct revelation from God.
Awed by the mystery of it all, that his beloved had been chosen as the mother of his eagerly anticipated Lord, we can imagine how he would oversee every detail of the nativity. Where suspicion regarding Mary's purity once lurked, faith now reigned as he looked into the lovely face of Mary's Child. At last God's promises had been fulfilled; before him was the Babe through whom God's covenants would be established.
—Condensed from All the Men of the Bible by Herbert Lockyer.