It is narrated from Sayyiduna Jabir (may Allah be pleased with him) that the Prophet (peace and blessings be upon him) said: When the drop of semen settles in the womb of the mother and forty days pass over it, an angel comes to it and asks: "O Lord, what will be its provision?" It is informed. Then he asks: "O Lord, how long will its lifespan be?" It is informed. Then he asks: "O Lord, will it be male or female?" That too is informed. Then he asks: "O Lord, will it be wretched or blessed?" That too is informed.
Hadith Referenceمسند احمد / مسند المكثرين من الصحابة / 15269
Hadith Gradingحکم دارالسلام:صحيح لغيره، وهذا إسناد ضعيف لضعف خصيف الجزري، ويشهد له حديث حذيفة بن أسيد عند مسلم: 2645، وسيأتي فى المسند: 16142