The Torah learning and occupation of a fetus in its mother’s womb:
The Talmud states that there are no days that are as good for man as these days when the child is found in his mother’s womb. While in the mother’s womb a candle is lit on its head through which he can see from one end of the world to the other. Likewise, while in the mother’s womb the baby is taught the entire Torah.
Forgetting his learning: The Talmud concludes that as soon as he comes out into the air of the world an angel comes and slaps him on his mouth and causes him to forget the entire Torah.
The explanation in Chassidus and Mefarshim-A study of the soul not body: The meaning behind the above Talmudic statement is that the soul of the child is taught the entire Torah in heaven while it is in the state of gestation/Ibbur, and that this learning of Torah gives the child the power afterwards when he is alive to have the light of G-d shine within him and arouse feelings of love and fear of G-d. Likewise, if the person later on in life exerts himself tremendously in Torah learning he will be able to remember the Torah that he had learned prior to birth. The Maharal explains that the slapping of the child on his mouth by an angel is not literal, and rather refers to the entering of the soul into the body which occurs by birth, and is like the final touch to the making of a vessel, known as a Maka Bepatish.
The curriculum and learning schedule on Thursday night:
A most interesting, related aspect regarding the above Talmudic statement is recorded in the Reshimos of the Rebbe Rayatz. This statement was heard from one of the most elderly Admurim of the previous generation while he stayed for Shabbos in the city of Pramishlan, who said it in the name of his grandfather who was a student of the Baal Shem Tov. The following is the statement: Before a child is born, he is taught the entire Torah, and I heard from my teacher the Baal Shem Tov, that on Thursday nights the child is taught the weekly Parsha together with the commentary of Rashi. Now, one who G-d has blessed with a good memory, when he becomes older and studies the Parsha on Thursday night together with the commentary of Rashi, he remembers the insights that he was taught prior to being born. After the above said Admur repeated this statement in the name of his grandfather, he stated that ever since then he makes sure to study the weekly Parsha together with the commentary of Rashi on every Thursday night.
 See Nidda 30b; Iyun Yaakov ibid; Likkutei Torah Parshas Vayikra 3a; Shelach 44a; Shir Hashirim 8:4; Likkutei Sichos 5:13; Maharal in Gevuros Hashem 28; Noam Elimelech Likkutei Shoshana; Bnei Yissachar Sivan 1
 Nida 30b “Rebbe Simlaiy expounded that the fetus….and a candle is lit on its head through which he can see from one end of the world to the other as the verse [Iyov 29:3] states “Behalo Neiro Alei Roshi Leoro Eilech Choshech” and do not be surprised about this, as when a person is sleeping he can dream of things in [the far away city of] Aspamya, and there are no days that are as good for man as these days [that he is in his mother’s womb], as the verse [Iyov 29:2] states “Mi Yitineini Keyarchei Kedem, Kimei Elokah Yishmireini”.. And they teach him all of the Torah as the verse [Mishlei 4:4] states “Vayoreini Vayomer Li Yitmecha Divrei Libecha, Shemor Mitzvosaiy Vachaya” and it also states [Iyov 29:4] “Kasher Hayisi Bimei Charfi Besod Elokjah Alaiy Ahali.” Now, as soon as he comes out into the air of the world an angel comes and slaps him on his mouth and causes him to forget the entire Torah as the verse [Bereishis 4:7] states “Lipesach Chatas Roveitz.”
 It, however, does not state in the Talmud that the angel hits him under the nose, on top of the lips, and that this hit is what is responsible for the groove that is under the nose on top of the lips [known as the philtrum]. I am not aware of any source for this aspect of the saying and I do not believe that it is true, as a) even Gentiles [who are prohibited from learning Torah and certainly do not learn the entire Torah in the mother’s womb-see Likkutei Sichos 5:13] have this groove, and b) as we will now explain, the above statement is not literal, and refers to the soul of the child not to his actual body within his mother’s womb.
 Admur in Likkutei Torah Parshas Vayikra 3a and in greater detail in Parshas Shelach p.44; This is likewise written in the works of the Maharal that the Torah is only taught to the soul of the child which is in heaven.
 From this statement we can understand two things: 1) that the Talmudic statement is not literal that the fetus in the mother’s womb has great intellectual capabilities, including the ability to communicate in a language, in order so he is able to learn and comprehend the information he is taught by his mystical angelic teacher who teaches him the entire Torah while he is physically in the womb. Rather, the intent is spiritual, and refers to the soul the child while it is still in heaven, as in truth the body of the fetus contain zero intellectual capabilities at all and cannot even communicate through any language. 2) that although the angel comes along prior to birth and makes the soul the child forget all of his Torah learning, nevertheless, this later on gives the child the potential to re-shine within him the light of Torah. This answers the question of why at all the soul of the child is taught the entire Torah, if in any event the angel will make him forget it prior to birth. To understand this matter a little deeper, the same way that a child goes through a gestation period from the time of conception until birth which forms and develops the body of the child, the same applies regarding the child’s soul up in heaven, that it too goes through a gestation period to help develop its soul characters. Thus, also the soul of the child goes through a state of pregnancy and gestation, and it is this part of the child that Rebbe Simlaiy referred to in all of his magnificent statements.
 Implication of Admur in Likkutei Torah Shir Hashirim; So is similarly written in Eitz Yosef, that the learning in the mother’s womb helps the child learn Torah later on in his life, and come to a true understanding of Torah, and the reason that he is made to forget the Torah is so he has freedom of choice and be required to exert effort in his learning. The Rebbe mentions a similar answer in Likkutei Sichos.
 Keser Shem Tov Hosafos p. 348 ; Hatamim 2:76 [85b]; Reshimos of Rebbe Rayataz