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:51:49

And of all things We created two mates; perhaps you will remember.  

And of all things (wa-min kulli shay’in is semantically connected to His ˹following˺ words khalaqnā) We created pairs, two kinds, such as male and female, heaven and earth, sun and moon, plain and mountain, summer and winter, sweet and bitter, light and darkness, that perhaps you might remember (tadhakkarūna: one of the two original tā’ letters ˹of tatadhakkarūna˺ has been omitted), and hence realise that the Creator of pairs is ˹Himself˺ Singular, that you might then worship him.
القرآن:٥١:٤٩

وَمِنْ كُلِّ شَيْءٍ خَلَقْنَا زَوْجَيْنِ لَعَلَّكُمْ تَذَكَّرُونَ  

{ومن كل شيء} متعلق بقوله: خلقنا {خلقنا زوجين} صنفين كالذكر والأنثى والسماء والأرض، والشمس والقمر، والسهل والجبل، والصيف والشتاء، والحلو والحامض والنور والظلمة {لعلكم تذكَّرون} بحذف إحدى التاءين من الأصل فتعلمون أن خالق الأزواج فرد فتعبدوه.