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:21:96

Until when ˹the dam of˺ Gog and Magog has been opened and they, from every elevation, descend  

Until (hattā, ˹a particle˺ expressing the end of the prohibition of their return) when Gog and Magog (read Ya’jūju wa-Ma’jūju or Yājūju wa-Mājūju, ˹these are˺ non-Arabic names of two tribes; there is an implicit genitive annexation before this clause, namely, the ˹gates of the˺ sadd, ‘the barrier’, ˹built˺ against them) are let loose (read futihat or futtihat) — and this will happen near the ˹time of the˺ Resurrection — and they slide down, they hasten, from every slope, ˹every˺ highland.
القرآن:٢١:٩٦

حَتَّىٰ إِذَا فُتِحَتْ يَأْجُوجُ وَمَأْجُوجُ وَهُمْ مِنْ كُلِّ حَدَبٍ يَنْسِلُونَ  

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