Cross listed to Daf Yummy.
On Berachot 20a, the following:
R. Johanan was accustomed to go and sit at the gates of the bathing place. He said: When the daughters of Israel come up from bathing they look at me and they have children as handsome as I am.12This corresponds to an ancient belief held by Galen, and also held by Chazal, of maternal impression. What the woman sees of is thinking about when she has intercourse would have an impact on the baby. This accounts, if I recall correctly, for a Roman matron having a black baby.
In that regard, I am reminded of the following joke:
A missionary is sent into deepest darkest depths of Africa to live with a tribe. He spends years with the people, teaching them to read, write and good Christian values. One thing he particularly stresses is the evil of sexual sin. Thou must not commit adultery or fornication!
One day the wife of one of the Tribes noblemen gives birth to a white baby. The village is shocked and the chief is sent by his people to talk with the missionary.
You have taught us of the evils of sexual sin, yet here a black woman gives birth to a white child. You are the only white man who has ever set foot in our village. Anyone can see whats going on here!
The missionary replies, No, no, my good man. You are mistaken. What you have here is a natural occurrence - what is called an albino. Look to thy yonder field. See a field of white sheep, and yet amongst them is one black one. Nature does this on occasion.
The chief pauses for a moment then says, Tell you what, you don't say anything about the sheep, I won't say anything about the white baby.This also finds purchase in the Torah, with Yaakov using striped sticks to influence the sheep to have striped offspring, and as interpreted by Chazal.
Even Shadal adopts this ancient science as likely. See here on parshablog. Other interpretations of that pasuk are still possible.
It seems that the following halacha:
See for example Shulhan Arukh, Yoreh Deah 198:48, where R. Moses Isserles states that if a woman coming home from the mikveh enounters a דבר טמא או גוי , if she is pious she will immerse again.Is based on this theory of maternal impression. Here is the Rama:
I think that even besides this, we don't need to concern ourselves with these quasi-kabbalistic concerns which are really rooted in ancient science which was only recently uprooted. This was not encoded as halacha by the gemara, and at this point, we know that this recommendation by specific Rishonim and Acharonim was based on incorrect science.