Abu Tufayl reported,

I entered upon Abu Sariha Huzaifa bin Usayd al-Ghifari, and he said, "I heard the Messenger of Allah ﷺ with these two ears of mine say, 'The drop of fluid settles in the womb for forty nights, then the angel takes shape over it.'"Zuhayr said, "I think he said, 'the angel who forms it.'""The angel then says, 'My Lord, male or female?' So Allah makes it male or female. Then he says, 'My Lord, sound or defective?' So Allah makes it sound or defective. Then he says, 'My Lord, what is its provision, what is its lifespan, what is its character?' Then Allah makes it wretched or happy."

Muslim 6728

Sahih

حدثني محمد بن أحمد بن أبي خلف حدثنا يحيى بن أبي بكير حدثنا زهير أبو خيثمة حدثني عبد الله بن عطاء أن عكرمة بن خالد حدثه أن

أبا الطفيل حدثه قال

دخلت على أبي سريحة حذيفة بن أسيد الغفاري فقال سمعت رسول الله ﷺ بأذني هاتين يقول إن النطفة تقع في الرحم أربعين ليلة ثم يتصور عليها الملك قال زهير حسبته قال الذي يخلقها فيقول يا رب أذكر أو أنثى فيجعله الله ذكرا أو أنثى ثم يقول يا رب أسوي أو غير سوي فيجعله الله سويا أو غير سوي ثم يقول يا رب ما رزقه ما أجله ما خلقه ثم يجعله الله شقيا أو سعيدا

مسلم 6728صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Muslim
Book
Decree
Chapter
How the human is created in his mother's womb and the recording of his provision, lifespan, deeds, misery, and happiness
Numbering
Darussalam 6728
Muslim 6728