it has actually been seen in quite a few reptiles and amphibians, that when a populetion is in some way limited to female only then one of the females will "become" male. There are also cases, again in reptiles and amphibiaians, of self procreation, which is this parthenogensis. Both occur when there is no male presence in the population. This was not the case in Mary's time, she was, afterall, to be married. So it is safe to assume that there were males around her.
Also this has never been seen in mammals, and there are significant differences between the biology of mammals and reptiles/amphibians.