
Two men married two women under the same chuppah, and after the wedding ceremony the brides were switched and had sexual relations with the other man. They committed the accidental sin of adultery and cannot remarry immediately; they have to wait three months lest a bastard child be in their wombs. (This is how they used to check for pregnancy; after three months one can see, by the size of the belly, whether the woman is pregnant.)
The scholars asked: A virgin cannot become pregnant from her first sexual intercourse, so why do the brides have to wait three months lest they had become pregnant? One sage, Rav Nachman, answered that the grooms had sex with the switched brides twice, and the fear that the women had become pregnant stems from the second act of intercourse. But if there had only been a single act of intercourse the women are permitted to remarry without a waiting period. The scholars continued, and asked: it is related in the Torah (Genesis 38:24) that when Tamar had sexual intercourse with Judah she was a virgin, but she became pregnant. This would imply that a virgin can become pregnant the first time she has sex. Rav Nachman responded: Tamar broke her hymen with her finger before she had sexual intercourse with Judah, and that is why she became pregnant. Rav Nachman brought support for his claim that Tamar broke her hymen with her finger by citing the virgins of the household of Rabbi (editor of the Mishnah) who broke their own hymens with their fingers before their marriages and who were called “Tamar” after the Biblical Tamar, who broke her own hymen. The scholars then asked: Tamar met Judah and had sexual relations with him after she had already been married twice, to two different men — Er and Onan. So why do the sages claim that Tamar was a virgin? The scholars answered that in her marriages to Er and to Onan, Tamar had anal sex only, and so remained a virgin.
Why did Er and Onan only have anal sex with Tamar? Onan did not want children, and Er feared that if Tamar became pregnant her beauty would fade.
(Babylonian Talmud, Tractate Yevamot 33b-34b)