Matthew 1: 20-21
But while he thought about these things, behold, an angel of the Lord appeared to him in a dream, saying, “Joseph, son of David, do not be afraid to take to you Mary your wife, for that which is conceived in her is of the Holy Spirit. And she will bring forth a Son, and you shall call His name Jesus, for He will save His people from their sins.”
Righteous Joseph was confused in his heart when he heard of the pregnancy of Our Most Holy Mother of God. Being her betrothed and guardian, he assumed that she was with a man. However, an Angel came to Saint Joseph in a dream and revealed her pregnancy was a Miraculous Conception, and Our Most Holy Mother of God was chosen by God to bring the Saviour into the world. Saint Joseph understood this and remained her guardian for the rest of his life.