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:42:50

Or He makes them ˹both˺ males and females, and He renders whom He wills barren. Indeed, He is Knowing and Competent.  

Or He combines them, that is to say, ˹or˺ He makes them, males and females; and He makes whomever He will infertile, such that she is unable to conceive or he cannot have a child. Surely He is Knower, of what He creates, Powerful, in ˹bringing about˺ whatever He will.
القرآن:٤٢:٥٠

أَوْ يُزَوِّجُهُمْ ذُكْرَانًا وَإِنَاثًا ۖ وَيَجْعَلُ مَنْ يَشَاءُ عَقِيمًا ۚ إِنَّهُ عَلِيمٌ قَدِيرٌ  

{أو يزوجهم} أي يجعلهم {ذكراناً وإناثاً ويجعل من يشاء عقيماً} فلا يلد ولا يولد له {إنه عليم} بما يخلق {قدير} على ما يشاء.