The Tribes of Gog and Magog are referred to in a couple of places in the Quran. In one place in the Quran, God makes it clear that these tribes existed during the time of Dhul-Qarnain. God says:
Then he [Dhul-Qarnain] followed (another) way, until, when he reached between two mountains, he found, before them a people who scarcely understood a word. They said, ‘O Dhul-Qarnain! Verily! Gog and Magog are doing great mischief in the land. Shall we then pay you a tribute in order that you might erect a barrier between us and them?’ He said, ‘That which my Lord had established me is better (than your tribute). So help me with strength (of men), I will erect between you and them a barrier.
Give me pieces (blocks) of iron,’ then, when he had filled up the gap between the two mountain-cliffs, he said, ‘Blow,’ till when he had made it (red as) fire, he said, ‘Bring me molten copper to pour over it.’ So they [Gog and Magog] were made powerless to scale it or dig through it.
[Dhul-Qarnain] said, ‘This is a mercy from my Lord, but when the Promise of my Lord comes, He shall level it down to the ground. And the Promise of my Lord is ever true.’ And on that Day [i.e., the day Gog and Magog will come out], We shall leave them to surge like waves on one another, and the Trumpet will be blown, and We shall collect them all together. (Quran 18:92-99)
Elsewhere in the Quran, God also speaks about them as a sign of the end of times. God says:
Until, when Gog and Magog are let loose (from their barrier), and they swiftly swarm from every mound. And the true promise (Day of Resurrection) shall draw near (of fulfillment). Then (when mankind is resurrected from their graves), you shall see the eyes of the disbelievers fixedly stare in horror. (They will say), ‘Woe to us! We were indeed heedless of this; nay, but we were wrongdoers.’ (Quran 21:96-97)
The Prophet (peace be upon him) gave the following description for the ruthlessness of these tribes when they are finally released upon the world:
“Gog and Magog would walk until they would reach the mountain of al-Khamar and it is a mountain of Bait-ul-Maqdis and they would say, ‘We have killed those who are upon the earth. Let us now kill those who are in the sky’ and they would throw their arrows towards the sky and the arrows would return to them besmeared with blood.”
Ahmad recorded the following hadith in his Musnad:
“Every day, Gog and Magog are trying to dig a way out through the barrier. When they begin to see sunlight through it, the one who is in charge of them says, ‘Go back; you can carry on digging tomorrow,’ and when they come back, the barrier is stronger than it was before. This will continue until their time comes and God wishes to send them forth.
They will dig until they begin to see sunlight, then the one who is in charge of them will say, “Go back; you can carry on digging tomorrow, God willing.”
In this case he will make an exception by saying, ‘God willing,’ thus relating the matter to the Will of God. They will return on the following day, and find the hole as they left it. They will carry on digging and come out against the people. They will drink all the water, and the people will entrench themselves in their fortresses.
Gog and Magog will fire their arrows into the sky, and they will fall back to earth with something like blood on them. Gog and Magog will say, ‘We have defeated the people of earth, and overcome the people of heaven.’
Then God will send a kind of worm in the napes of their necks, and they will be killed by it. By Him (God) in Whose hand is the soul of Muhammad, the beasts of the earth will become fat.”
In the lengthy hadith from which two portions have been quoted above, the Prophet further described the relationship between Jesus and the tribes of Gog and Magog. After Jesus will kill the false messiah, the Prophet continued speaking about what would occur:
“Then a people whom God had protected would come to Jesus, son of Mary, and he would wipe their faces and would inform them of their ranks in Paradise and it would be under such conditions that God would reveal to Jesus these words, ‘I have brought forth from amongst My servants such people against whom none would be able to fight; you take these people safely to the Mount of Toor, and then God would send Gog and Magog and they would swarm down from every slope.
The first of them would pass the lake of Tiberius and drink out of it. And when the last of them would pass, he would say, ‘There was once water there.’
Jesus and his companions would then be besieged here (at Toor, and they would be so hard pressed) that the head of the ox would be dearer to them than one hundred dinars (old currency) and God’s Apostle, Jesus, and his companions would supplicate to God, Who would send to them insects (which would attack the necks of the Gog and Magog) and in the morning they would perish like one single person.
God’s Apostle, Jesus, and his companions would then come down to the earth and they would not find in the earth as much space as a single span which is not filled with their putrefaction and stench. God’s Apostle, Jesus, and his companions would then again beseech God, Who would send birds whose necks would be like those of Bactrian camels and they would carry them and throw them where God would will.
Then God would send rain which no house of clay or (the tent of) camels’ hairs would keep out and it would wash away the earth until it could appear to be a mirror.
Then the earth would be told to bring forth its fruit and restore its blessing and, as a result thereof, there would grow (such a big) pomegranate that a group of persons would be able to eat that, and seek shelter under its skin, and a milch cow would give so much milk that a whole party would be able to drink it.
And the milch camel would give such (a large quantity of) milk that the whole tribe would be able to drink out of that and the milch sheep would give so much milk that the whole family would be able to drink out of that.
At that time God would send a pleasant wind which would soothe (people) even under their armpits, and would take the life of every Muslim and only the wicked would survive who would commit adultery like asses and the Last Hour would come upon them.”
In another important hadith from Sahih Muslim, the Prophet spoke about the future coming of Gog and Magog and, at the same time, stated a very important lesson that all should reflect upon. This lesson has to do with the importance of not allowing evil to be prevalent in society. In this narration, the Prophet said,
“There is no god but God! There is a destruction in store for Arabia because of turmoil which is at hand, the barrier of Gog and Magog has opened so much.”
And Sufyan [the sub-narrator] made a sign of ten with the help of his hand (in order to indicate the width of the gap) and I [Zainab, the Prophet’s wife] said,
“God’s Messenger, would we be perished in spite of the fact that there would be good people amongst us?”
“Of course, but only when the evil predominates.”
(Incidentally, there is a great deal of speculation concerning who exactly these tribes are. However, due to space limitations, the discussion here is limited to what is known directly from the texts of the Quran and Sunnah. As such, these are the tribes of Gog and Magog and, with respect to identifying them, very little more can be said, although a couple of hadith do give further information concerning their physical characteristics.)
Allah knows Best.