Dalil

Quran Ash-Shuraa 42:50

أَوۡ يُزَوِّجُهُمۡ ذُكۡرَانٗا وَإِنَٰثٗاۖ وَيَجۡعَلُ مَن يَشَآءُ عَقِيمًاۚ إِنَّهُۥ عَلِيمٞ قَدِيرٞ

Translation

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