This is how the birth of Jesus Christ came about. His mother Mary and Joseph had promised to get married. But before they started to live together, it became clear that she was going to have a baby. She became pregnant by the power of the Holy Spirit.
References for Matthew 1:18
Her husband Joseph was a godly man. He did not want to put her to shame in public. So he planned to divorce her quietly.
But as Joseph was thinking about this, an angel of the Lord appeared to him in a dream. The angel said, "Joseph, son of David, don't be afraid to take Mary home as your wife. The baby inside her is from the Holy Spirit.
She is going to have a son. You must give him the name Jesus. That is because he will save his people from their sins."
All of this took place to bring about what the Lord had said would happen. He had said through the prophet,
"The virgin is going to have a baby. She will give birth to a son. And he will be called Immanuel."(Isaiah 7:14) The name Immanuel means "God with us."
Joseph woke up. He did what the angel of the Lord commanded him to do. He took Mary home as his wife.
But he did not make love to her until after she gave birth to a son. And Joseph gave him the name Jesus.