Hudhaifa bin Usaid reported directly from Allah's Messenger (ﷺ) that he said: When the drop of (semen) remains in the womb for forty or fifty (days) or forty nights, the angel comes and says: My Lord, will he be good or evil? And both these things would be written. Then the angel says: My Lord, would he be male or female? And both these things are written. And his deeds and actions, his death, his livelihood; these are also recorded. Then his document of destiny is rolled and there is no addition to it nor subtraction from it.
Explanation & Benefits
Shaykh Maulana Abdul Aziz Alvi
Hadith Commentary: Benefits and Issues:
From this hadith, it is understood that the four matters mentioned above are written in the second stage.
Whereas from the hadith of Abdullah ibn Mas'ud radi Allahu anhu, it is understood that this is decided after the third stage, that is, after four months.
However, the correct view appears to be that the initiation of these matters begins in the second stage,
but their completion occurs after the third stage,
when the human being’s limbs, bones, and flesh become fully distinct.
Therefore, there is no contradiction between the two hadiths,
because in the hadith of Hudhayfah radi Allahu anhu, it is stated that this occurs after forty or forty-five days or nights, and “after” does not necessarily mean that it happens immediately.
Source: Tuhfat al-Muslim: Commentary on Sahih Muslim, Page: 6725