Our Gemara on Amud Beis asserts the biological reality that the fetus is formed inside the woman by day forty.
This number — forty days to substantiate formation — has a number of spiritual and metaphysical implications. For example, Shem MiShmuel (Mishpatim) explains that 40 equals a complete formation, body and soul, while 39 is all the physical aspects without the spiritual. This is why the fetus is formed in forty days. The verse decrees forty lashes (Devarim 25:3), to serve as a minor form of punishment in place of death. Yet our sages limit the lashes to 39 (Makkos 22a), as if to say: the 39 physical parts of existence are punished, but your soul is spared. He says this too is similar to the six days of creation, and then the supernatural addition of the Shabbos day. The Jewish slave who is sold as a punishment for stealing endures six years for his physical indulgence and the weaknesses that led him to sin, but the seventh part, his soul, is noted as remaining pure. Or the seven days prior to the bris, with the eighth day representing a supernatural transcendence.
Similarly, Benei Yissaschar (Chodesh Tammuz–Av, Ma’amar 4) says the 15th of Av was a time auspicious for marriage because it was forty days prior to 25 Elul, the day of creation. That is, the world was conceived (literally) in God’s thought forty days before, and it took forty days to form.
I will add: Moshe too was in heaven for forty days to receive the Torah, which represented a new era in existence — a re-creation of the world. Even the 39 forms of forbidden work on Shabbos can be seen as 39 dimensions of physical existence, while the 40th is the final spiritual dimension. And in a less happy circumstance, the flood waters rained for forty days and forty nights, a complete obliteration of all of creation, the physical and the spiritual, a total loss with nothing redeemable.
While all this numerology might seem like “shalosh seudos Torah,” numbers in the ancient world were seen as evidence of divine purpose and planning. It doesn’t enter into our consciousness in the same way because the idea of randomness is a relatively new mathematical concept and orientation. The ancients simply did not believe in randomness. A particular formula such as pi, or the Pythagorean Theorem, had to mean something. And whatever it meant, it had divinity to it, because it was, we might say, leftover snippets of code left by the master programmer. This is why the ancient school of Pythagoras was a secret, mystical school, and the idea of the divine hidden inside the numbers was intuitive and valid. Numerology is an old tradition within humanity, just as sacrifices and incense were an old tradition utilized by Jew and gentile alike.
Previous