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:29

And of his signs is the creation of the heavens and earth and what He has dispersed throughout them of creatures. And He, for gathering them when He wills, is competent.  

And of His signs is the creation of the heavens and the earth and, the creation of, whatever He has scattered, ˹whatever˺ He has divided and spread, in them in the way of creatures (dābba: this denotes all those ˹creatures˺ which tread ˹yadubbu˺ upon the earth, whether human beings or otherwise). And He is able to bring them together, for the Gathering, whenever He will (rational beings as opposed to others predominate in the ˹suffixed˺ pronoun ˹-him of jam‘ihim, ‘to bring them together’˺).
القرآن:٤٢:٢٩

وَمِنْ آيَاتِهِ خَلْقُ السَّمَاوَاتِ وَالْأَرْضِ وَمَا بَثَّ فِيهِمَا مِنْ دَابَّةٍ ۚ وَهُوَ عَلَىٰ جَمْعِهِمْ إِذَا يَشَاءُ قَدِيرٌ  

{ومن آياته خلق السماوات والأرض} خلق {ما بث} فرق ونشر {فيهما من دابة} هي ما يدب على الأرض من الناس وغيرهم {وهو على جمعهم} للحشر {إذا يشاء قدير} في الضمير تغليب العاقل على غيره.