They (two tribes or peoples) will appear at the time of Jesus
son of Mary, after the Dajjaal. Allah will destroy them all in
one night, in response to the supplication of Jesus.
Abu Hurayrah reported that the Prophet (S) said, "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
Allah 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, in shaa'Allah.' In
this case he will make an exception by saying in shaa'Allah,
thus relating the matter to the Will of Allah. 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 find the hole as they left it, 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 Allah will send a kind of worm in
the napes of their nacks, and they will be killed by it...'By
Him a in Whose hand is the soul of Muhammad, the beasts of the
earth will become fat.'" [Tirmidhee, Abwaab al-Tafseer:
Surat al-Kahf (Hadith 5160), 8/597-99; Ibn Maajah, Kitaab al-Fitan,
(Hadith 4080), 2/1364. Ahmad, Musnad, 2/510, 511.]
Gog and Magog are two groups of Turks, descended from Yaafith
(Japheth), the father of the Turks, one of the sons of Noah. At
the time of Abraham (AS), there was a king called Dhoo'l-Qarnayn.
He performed Tawaaf around the Ka'bah with Abraham (AS) when he
first built it; he believed and followed him. Dhoo'l-Qarnayn was
a good man and a great king; Allah gave him great power and he
ruled the east and west. He held sway over all kings and
countries, and travelled far and wide in both east and west. He
travelled eastwards until he reached a pass between two
mountains, through which people were coming out. They did not
understand anything, because they were so isolated; they were
Gog and Magog. They were spreading corruption through the earth,
and harming the people, so the people sought help from
Dhoo'l-Qarnayn. They asked him to build a barrier between them
and Gog and Magog. He asked them to him to build it, so together
they built a barrier by mixing iron, copper and tar.
Thus Dhoo'l-Qarnayn restrained Gog and Magog behind the barrier.
They tried to penetrate the barrier, or to climb over it, but to
no avail. They could not succeed because the barrier is so huge
and smooth. They began to dig, and they have been digging for
centuries; they will continue to do so until the time when Allah
decrees that they come out. At that time the barrier will
collapse, and Gog and Magog will rush out in all directions,
spreading corruption, uprooting plants, killing people. When
Jesus (AS) prays against them, Allah will send a kind of work in
the napes of their necks, and they will be killed by it.
Antoher relevant hadeeth:
-"Ibn Mas'ood reported that the Prophet (S) said, "On
the night of the Israa' (night journey), I met my father
Abraham, Moses and Jesus, and they discussed the Hour. The
matter was referred first to Abraham, then to Moses, and both
said, 'I have no knowledge of it'. Then it was referred to
Jesus, who said, 'No one knows about its timing except Allah;
what my Lord told me was that the Dajjaal will appear, and when
he sees me he will begin to melt like lead. Allah will destroy
him when he sees me. The Muslims will fight against the Kaafirs,
and even the trees and rocks will say, "O Muslim, there is
a Kaafir hiding beneath me - come and kill him!" Allah will
destroy the Kaafirs, and the people will return to their lands.
Then Gog and Magog will appear from all directions, eating and
drinking everything they found. The people will complain to me,
so I will pray to Allah and He will destroy them, so that the
earth will be filled with their stench. Allah will send rain
which will wash their bodies into the sea. My Lord has told me
that when that happens, the HOUR WILL BE VERY CLOSE, LIKE A
PREGNANT WOMAN WHOSE TIME IS DUE, BUT HER FAMILY DO NOT KNOW
EXACTLY WHEN SHE WILL DELIVER."
[Ahmad, Musnad, 1/375. Similar Hadith in Ibn Maajah, Kitaab al-Fitan
(hadith 4081), 2/1365, 1366]