Clearly, if Mary really existed and the myth is truly based at least loosely on actual events, she had sex. Either she was raped or she did so willingly. Either with her husband or with someone else. If her husband wasn't the father, then Jesus was a bastard.
The rational explanation beats the supernatural one that she was raped by a deity, but deities raping or having consensual intercourse with mortal women is an archetype that appears in various cultures, particularly the ancient Greek and in Mesopotamian cultures.
It's more likely that the "virgin" Mary myth was based on an older, but similar, tale of oral or written oral origin.
Maybe it was an Alien with a long thin turkey baster.