The Virgin birth doctrine isn't Biblical. It's just a myth that the Church borrowed from from ancient pagan pantheons. I will provide an explanation on what the context of scripture is:
[Matthew 1:18] Now the birth of Jesus Christ was on this wise: When as his mother Mary was espoused to Joseph, before they came together, she was found with child of the Holy Ghost. (KJV)
It is to be read as: "Before they consummated the marriage, Mary was pregnant." This does not indicate that they didn't have sex before marriage. Joseph was a Nazarite, and the Nazarites had their own customs. The Nazarites only had sex for the purpose of procreation. To them, the making love with one woman constituted a union. The institution of marriage was only a Judaean custom, and it would have been socially unacceptable if everyone knew she was pregnant before they were married according to Judaean tradition. That is why Joseph was commanded to hide Mary (v 19).
Joseph, being a Nazarite, had the Holy Spirit (meaning he was set-apart and righteous). So when Joseph impregnated her, she was so by the Holy Spirit. This is the only interpretation that makes sense. An ovum cannot fertilize and begin meiosis without sperm, and no woman’s hymen can remain intact after giving birth—even if she was impregnated “miraculously”. It is absurd to believe otherwise, even by God’s standards.
The same interpretation is applied to v. 25. They didn’t have sex while she was pregnant. This doesn’t mean they didn’t do it before she got pregnant, which obviously they did.
No truth can be contrary to reason. Therefore, when it is said that "What is impossible with men is possible with God," it is to be understood not that God does things which are mischievous or absurd, but that God has set forth the laws and statutes of the universe in harmonious clarity (Jeremiah 33:25, Job 38).