The Prophet ﷺ said, "Allah has assigned an angel to the womb. The angel says, 'My Lord, a drop of fluid. My Lord, a clot. My Lord, a lump of flesh.' Then, when Allah wills to complete its creation, the angel asks, 'My Lord, male or female? Wretched or blessed? What is its provision? What is its lifespan?' All of this is written while the child is still in its mother's womb."
حدثنا سليمان بن حرب حدثنا حماد عن عبيد الله بن أبي بكر بن أنس
عن النبي ﷺ قال وكل الله بالرحم ملكا فيقول أي رب نطفة أي رب علقة أي رب مضغة فإذا أراد الله أن يقضي خلقها قال أي رب أذكر أم أنثى أشقي أم سعيد فما الرزق فما الأجل فيكتب كذلك في بطن أمه