The virgin birth tale was not in the earliest gospel. It came along later when an unknown writer wanted the Jesus story ramped up. He wrote in a miracle, Jesus was born to a woman who never had sex.
The earliest gospel written, Mark, has nothing about Jesus’ birth. It pops up in the third one written, Matthew.
The Old Testament book of Isaiah 7:14 says in most Bibles, “A virgin shall conceive and bear a son and you shall name him Immanual.” A long time later, 800 years, Matthew repeats this. There are two problems with what Matthew does.
First, Isaiah was not predicting a future messiah. He was predicting the end of a war going on at that time. The war will end, he said, when the child that is born is old enough to know right from wrong.
Second, Matthew was translating from the Hebrew used 800 years earlier into Greek. Modern scholars now see the word he translated into “virgin” did not refer to a woman who had not had sex. It referred, instead, to a ”young woman”. Thus, the passage should have read, “A young woman has conceived and will bear a son…”
The author of Isaiah was aiming a specific audience of his time with a specific purpose in mind. An unknown author 800 years later, eventually assigned the name of Matthew, was aiming at a different audience with a different goal.
Even if the story is a mistake, people love it anyway.
The Bible; A Historical and Literary Introduction. Bart Erhman, Oxford University Press, 2013.