1) AGADAH: THE BABY'S CRAVINGS IN THE MOTHER'S WOMB
QUESTIONS: The Mishnah (82a) states that if a pregnant woman develops a craving for food she smells on Yom Kippur, she may eat until her spirit is revived. The Gemara relates two such incidents. In the first, Rebbi was asked what should be done for a pregnant woman who smelled food and craved it on Yom Kippur. He responded that they should whisper into her ear that it is Yom Kippur (in the hope that the fetus would hear and stop craving the food, -Rashi). They did so, and her craving subsided. Rebbi described her unborn baby with the verse, "Before I formed you in the stomach, I recognized you, and before you left the womb I sanctified you" (Yirmeyahu 1:5). That child became the righteous and holy Rebbi Yochanan.
In another incident, Rebbi Chanina similarly ruled that they should whisper into the ear of a pregnant woman who craved food she had smelled that it is Yom Kippur. This time, however, her craving did not abate, and they had to feed her in order to prevent danger to her life. Rebbi Chanina referred to the unborn child with the verse, "The wicked are estranged from the womb" (Tehilim 58:4). That child turned out to be the wicked Shabsai who hoarded produce and drove prices up and caused many people to suffer.
The Acharonim have several insights about the incidents recorded by the Gemara.
(a) Why did Rebbi apply the verse, "... before you left the womb I sanctified you," to this child? In what way did the unborn child demonstrate "Kedushah," sanctity, and in what way did Rebbi Yochanan stand out as being especially holy after he was born?
Likewise, why did Rebbi Chanina choose the verse, "The wicked are estranged from the womb," to describe the fetus which did not give up its craving? What does that verse have to do with the specific act of the unborn child?
(b) The Gemara in Sanhedrin (91b) states that a person acquires a Yetzer ha'Ra only at the moment he exits his mother's womb (see Insights to Sanhedrin 91:3 with regard to the age at which the Yetzer ha'Ra enters a person). How could Rebbi and Rebbi Chanina declare an unborn child a Tzadik or Rasha?
(a) With regard to the righteous child, the TOSFOS YOM HA'KIPURIM explains that the Gemara in Ta'anis (10a) says that "one who fasts is called Kadosh" (because he separates himself from worldly pleasures). Rebbi saw that the unborn child was Kadosh because he abandoned his craving for food. During his lifetime, Rebbi Yochanan was known for his attribute of Kedushah. The Gemara relates that he was able to sit by the Mikvah and instruct women how to immerse themselves, without fear that his Yetzer ha'Ra would be aroused (Berachos 20a). The Gemara in Yevamos (20b) teaches that one who is not attracted to sensual lusts is considered Kadosh.
The TOSFOS YOM HA'KIPURIM and the VILNA GA'ON point out that the verse which Rebbi Chanina quoted with regard to the second child continues, "He does not listen to the voice of the whisperers" (Tehilim 58:6). These words allude to an unborn child who does not listen when someone whispers to him that today is Yom Kippur and he continues to crave for food. The unborn child in this incident did not listen to the whisperers and insisted on fulfilling his lustful desires. When he grew up, Shabsai was unable to curb his lust for money, and he oppressed the poor by hoarding the produce and raising the prices.
(b) The TOSFOS YOM HA'KIPURIM explains that the Gemara in Sanhedrin means that the Yetzer ha'Ra only begins to rule ("Sholet") over a person after he is born. Even before he is a born he has a Yetzer ha'Ra, and it was the presence of that Yetzer ha'Ra which influenced the unborn child to eat.
Alternatively, HA'GA'ON RAV SHLOMO WOLBE zt'l (Alei Shur II:182) explains that the first child exhibited the ability to change his natural tendency, while the second child did not even exhibit the ability to suppress his desires. Since the essence of a Tzadik is the ability to change one's natural tendency, and a Rasha is one who gives in to his desires, the Gemara applies these appellations to the fetuses who exhibited those traits (and not because they actually were held accountable for their actions in utero).
(The SEFER CHASIDIM (#1137) describes the extremely rare occasions on which a child can be dominated by his Yetzer ha'Ra before he is born and be pre-inclined to do evil. The Sefer Chasidim apparently understands that some people must struggle more than others to do good, due to their innate nature. The word "Rasha" in this context means "a person for whom it will be very difficult to choose to do good." See, for example, the incident recorded in Shabbos (156b) with regard to Rav Nachman and his head-covering, and see Insights to Yoma 22:3:b. See also Rashi at the beginning of Parshas Toldos, with regard to the character traits of Esav and Yakov in utero. -M. Kornfeld)
(c) The VILNA GA'ON finds an allusion in the Torah that it is possible to test whether an unborn child will be righteous or wicked based on the way he responds when he craves food on Yom Kippur and is told that the day is Yom Kippur and eating is forbidden. The last verse in Parshas Shemini says, "To distinguish between the impure (Tamei) and the pure (Tahor), and between the creature (Chayah) that may be eaten and the creature (Chayah) that may not be eaten" (Vayikra 11:47). The Vilna Ga'on explains this verse homiletically to mean, "In order to distinguish between the Tamei (the wicked person) and the Tahor (the righteous person), one can observe which Chayah (pregnant woman) eats [on Yom Kippur when the fetus craves food] and which Chayah does not eat."