An angel warns Joseph not to divorce Mary because the child was conceived by the Holy Spirit (1:20-21). The angel indicates that the conception of the child is by the Holy Spirit. While we usually talk about this as a virgin birth, it is better to think in terms of a virgin conception and a normal birth. There is nothing in the Bible which implies that there was anything unusual about the pregnancy after it begins. Jesus’ birth was normal and Mary and Joseph go on to have other children.
The Greek text does not have the definite article, the child is conceived by “a holy spirit.” There are a number of suggestions for what this might meet, at the very least it refers to the power of God as responsible for Mary’s pregnancy.
There is little use trying to figure out the “science” of how this happened, then whole point is that this is a miracle from God. The child is not Joseph’s nor is he the son of any human, he is the “son of God.” The connection of the Holy Spirit to the birth of Jesus is important for several reasons.
First, like Adam, the human Jesus is a special creation of God. Paul will use this parallelism between Adam and Jesus in Romans 5:12-21. The virgin birth is therefore analogous to the special creation of Adam in Genesis 2.
Second, the Hebrew Bible refers to the king of Israel as a “son of God.” In Ps 2:7, for example, the enthroned King of Heaven says to the king of Israel “you are my son, today I have begotten you.” The virgin birth is the ultimate enthronement of a king in the line of David. It is significant tat Joseph is called a “son of David” in this text, the only place in the New Testament where someone other than Jesus is given that title. This likely highlights the royal importance of the child to be born.
Third, there are many references to special servants of God in the Hebrew Bible who are born through miraculous circumstances. Beginning with Isaac, several old or barren women have children. Even John the Baptist is born in this classic “Old Testament”scenario. A virgin giving birth is the ultimate unlikely birth!
Fourth, there are a number of references to the coming messiah / servant of God as being specially empowered by the Spirit of God, Isa 11:2, for example, describes the “root of Jesse” as having the seven-fold Spirit of God upon him.
That the child is not the result of unfaithfulness, but rather a divine miracle, would comfort Joseph and assure him that this child is part of the larger plan of God.