To read more on the tradition of the virgin birth stories, see my newest series of essays:
The Virgin Birth: Miracle or Legend? Part I
The Virgin Birth: Miracle or Legend? Part II
The Virgin Birth: Miracle or Legend? Part III
A thread on the Internet message board I frequent recently had a post by one of the prominent atheists and skeptics that said:
"The virgin birth thing always makes me laugh. What probably happened is Joseph knocked up Mary, but they were too afraid to tell anyone, so some story about a virgin birth got made up. ("Really mom! I don't know how it happened! I had this dream...")"
While I certainly can agree with this person that the virgin birth stories in the bible are mythological, he is as wrong in his perception about the origins of the virgin birth stories as the literalists are in assuming the stories are literal histories.
The virgin birth stories did not get made up in an effort to explain away an illegitimate birth. More than likely, Jesus was born to Joseph and Mary, who were lawfully married and had normal marital sexual relations that produced a normal, healthy child.
Long after Jesus's death, and even after the deaths of all those who knew him personally - a good 3 generations after Jesus died - virgin birth stories began to circulate within the Christian community as a result of the natural progression of the mythology surrounding Jesus.
The concept of a great man being the literal son of a god, and therefore born to a human virgin who is impregnated by said god, was a common theme in ancient mythology.
The most prominent such theme during the time and location in which Jesus lived was the mythology surrounding Romulus, the founder of Rome. He and his twin brother were said to have been birthed by a Vestal Virgin who was raped by a god and later put to death for having children (if a Vestal Virgin lost her virginity, the punishment was death). This mythology was part of the way that later Romans justified raising Romulus to the level of a god himself. Julius Caesar had a statue built next to Romulus and other Roman gods, which was one of the actions that led to his assassination - he seemed to be claiming godship.
Another common virgin birth mythology, that would have been known to many people in the 1st century, was from the Mithras cult. Many parallels, in fact, exist between earlier Mithraic traditions and Christianity - much of what we understand today as Christian traditions were actually Mithraic traditions, later overlayed onto the emerging Christian religion. Mithraism was common in ancient Rome, up until the 4th century C.E., and Mithras was said to have been born of a virgin (although that was one of only many stories about his birth - others said he sprang from a rock). Incidentally, his birthday was celebrated on December 25th, which was the day the ancients calculated to be the date of the Winter Solstice, otherwise celebrated as the day the sun is born (because it's the day that the days begin getting longer; we know now the Winter Solstice actually occurs on December 21st or 22nd).
The Egyptian version ususally didn't involve a heavenly god impregnating a virgin, but it most certainly included a god-king impregnating his queen to produce a god-prince who would someday rule the kingdom.
Mithraism, the story of Romulus and Remus, and the general idea that great men must be conceived by gods rather than regular mortals, explain the genesis and development of the virgin birth stories surrounding Jesus. It had absolutely nothing to do with attempting to cover up any illegitimacies. If such scandals had surrounded Jesus's life - for instance, from enemies trying to discredit him - the last thing that people would do is say "Oh, well, his Mom got impregnated by God, that's how it happened!!" To even suggest such a thing is absurd. They clearly would have come up with some way to show that Joseph and Mary's union was lawful and that, therefore, Jesus's birth was legitimate.
It is clear that the virgin birth mythology surrounding Jesus has an origin completely unrelated to any attempt to cover up an embarassing illegitimacy. It does not appear in the Christian tradition until about 80-85 C.E., and it seems to disappear from the Christian tradition after about 95-100 C.E.
Indeed, the Gospels of Matthew and Luke are the only Christian writings in existence that mention anything about a virgin birth. None of the letters of Paul (written much earlier than any Gospel), none of the letters of later Christian leaders, neither the Gospels of Mark nor John nor any of the earliest Gnostic Gospels, nor any other canonical text, ever mentions a virgin birth.
Paul, the earliest Christian writer, actually uses terms to refer to Mary that would only be used to refer to a married, sexually-active woman. Mark, the earliest Gospel writer, mentions no virgin birth at all, and the writer of John (the last Gospel to be written), in addition to having no virgin birth tale, actually calls Jesus the "son of Joseph" in chapter 6!
The virgin birth may have, in fact, not even been a widespread belief among 1st century Christians - it may well have been a regional thing among Jewish Christians living in a small area of Roman Jerusalem, established first in writing by the author of Matthew, continued by the Gentile author of Luke, and then dying out thereafter, until resurrected by 2nd and 3rd century Christians who were beginning to study and assemble early Christian writings and attempting to develop a doctrinal view of the meaning of Jesus's life.