Asalaam Alaikum:How many days will the Gog and Magog will remain on Earth after they came out.
All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and Messenger.
After investigation, we have not come across a text that determines the period that Gog and Magog will remain on earth after they emerge. However, their period of stay will be less than forty years, which is the period that ‘Eesa (Jesus) will remain after his descent to earth, as Gog and Magog will emerge after the descent of Jesus and they will be exterminated before he dies.
The evidence that the duration of Jesus on earth after his descent is that Abu Hurayrah narrated that the Prophet, sallallaahu ‘alayhi wa sallam, said: "There is no Prophet between me and him (i.e. Jesus). He is to descend. When you see him, recognize him: a man of medium height, reddish fair, wearing two light yellow garments, looking as if drops were falling down from his head though it will not be wet. He will fight the people for the cause of Islam. He will break the cross, kill the swine, and abolish the Jizyah. Allaah will destroy all religions except Islam in his time. He will kill the Dajjaal and will live on the earth for forty years and then he will die, and the Muslims will pray at his funeral." [Abu Daawood - Al-Albaani classified it as Saheeh (sound)]
The evidence that Gog and Magog will emerge after the descent of ‘Eesa and that they will perish before his death, is that An-Nawaas ibn Sam‘aan said that "the Prophet, sallallaahu ‘alayhi wa sallam, mentioned the Dajjaal one morning. At times, he sometimes described him as being insignificant and at times as very significant, and we felt as if he were in the cluster of the date-palms… at length he said: He will then search for him (the Dajjaal) until he catches hold of him at the gate of Ludd (near Jerusalem) and kills him. Then a people whom Allaah will have protected from the Dajjaal will come to Jesus, son of Mary, and he will wipe over their faces and inform them of their ranks in Paradise. It will be under such conditions that Allaah will reveal to Jesus these words: I have brought forth from among My servants such people against whom none will be able to fight; you take these people (the believers) safely to Mount Toor; and then Allaah will send Gog and Magog and they will swarm down from every slope. The first of them will pass the lake of Tiberias and drink out of it. And when the last of them passes, he will say: There was once water there… Jesus and his companions will then be besieged there so that the head of an ox will be dearer to them than one hundred Dinaars are to you, and Allaah's Messenger, Jesus, and his companions will supplicate Allaah, Who will send insects to them (Gog and Magog), which attack their necks; and in the morning they will perish like one single person. Allaah's Messenger, Jesus, and his companions will then come down to the earth and they will not find on the earth as much space as a single span which is not filled with their putrefaction and stench. Jesus and his companions will then again beseech Allaah, Who will send birds whose necks are like those of Bactrian camels, and they will carry them and cast them wherever Allaah wills. Then Allaah will send rain which no house of clay or tent of camel hair keeps out, and it will wash clean the earth until it looks like a mirror. Then the earth will be told to bring forth its fruit and restore its blessing." [Muslim]
For more benefit on Gog and Magog, please refer to Fatwa 81773.
Allaah Knows best.
You can search for fatwa through many choices