Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:19:9

˹An angel˺ said, "Thus ˹it will be˺; your Lord says, 'It is easy for Me, for I created you before, while you were nothing.' "  

He said, ‘It, the matter ˹in question˺, of creating a boy from both of you, shall be so! Your Lord says, “It is easy for Me, namely, to restore your sexual potency and tear open your wife’s womb ˹in preparation˺ for conception, for I certainly created you before when you were nothing”’, ˹you were nothing˺ before your created form became manifest. As God wished to manifest this great power, He inspired him ˹the form of˺ the question, in order for him to receive the response that will indicate it ˹this power˺. And when his soul yearned for the prompt arrival of that whereof he had been given good tidings:
القرآن:١٩:٩

قَالَ كَذَٰلِكَ قَالَ رَبُّكَ هُوَ عَلَيَّ هَيِّنٌ وَقَدْ خَلَقْتُكَ مِنْ قَبْلُ وَلَمْ تَكُ شَيْئًا  

{قال} الأمر {كذلك} من خلق غلام منكما {قال ربك هو عليَّ هين} أي: بأن أرد عليك قوة الجماع وأفتق رحم امرأتك للعلوق {وقد خلقتك من قبل ولم تكُ شيئا} قبل خلقك ولإظهار الله هذه القدرة العظيمة ألهمه السؤال ليجاب بما يدل عليها ولما تاقت نفسه إلى سرعة المبشر به.