(Al-Kahf) 18 : 94
قَالُوا يَا ذَا الْقَرْنَيْنِ إِنَّ يَأْجُوجَ وَمَأْجُوجَ مُفْسِدُونَ فِي الْأَرْضِ فَهَلْ نَجْعَلُ لَكَ خَرْجًا عَلَىٰ أَنْ تَجْعَلَ بَيْنَنَا وَبَيْنَهُمْ سَدًّا

They said: "Oh Dul-Qarnayn! Indeed Gog and Magog are corrupters in the land; so may we assign for you expenditure so that you might make between them and us a barrier?"

Those people were living among the Gog and Magog who were barbarians and corrupters. So they asked Dul-Qarnayn to build a barrier to separate them. Verse 21: 96 also mentions about Gog and Magog. After the second coming of Jesus and killing Antichrist, Jesus will rule the world as one community as explained in verses 4: 158-159. Then after 7 years he will die and will be buried near Messenger Muhammad’s grave at Medina. Then the spreading of Gog and Magog will occur as a part of 10 Crucial Signs of Doomsday as explained in verses 6: 158-159. See explanation 17: 104.