Hell will never cease to exist and neither will its people
Question

Allah threatens the kaafirs and atheists with Hell, “they will abide therein for ages” [al-Naba’ 78:23]. Will their torment in the Fire continue forever, and if so, doesn’t that contradict Allah’s justice and mercy? Or will their punishment last for ages the length of which is known to Allah, and if so, what will their fate be after that, is there any reference to that in the Quran or Sunnah?
Praise be to Allah.What Ahl al-Sunnah wa’l-Jamaa’ah believe is that Hell will never cease to exist or be extinguished, and no one will be brought forth from it except the sinners among the people of Tawheed. As for the kuffaar and atheists, they will abide therein forever. 
Imaam Ibn Hazm said in his book Maraatib al-Ijmaa’: “Hell is real; it is an abode of torment that will never cease to exist, and its people will never cease to exist, they will remain there without end.” 
And he said in his book al-Fasl fi’l-Milal wa’l-Ahwa’ wa’l-Nihal: “All the sects of the ummah are agreed that Paradise and its delights will never cease to exist, and that Hell and its torments will never cease to exist, except for al-Jahm ibn Safwaan, Abu’l-Hudhayl al-‘Allaaf and some of the Raafidis. As for Jahm, he said that Paradise and Hell will cease to exist, as will their people. Abu’l-Hudhayl said that Paradise and Hell will not cease to exist, and neither will their people, but their movements will cease and they will remain immobile, never moving, and their people will be alive, being blessed or tormented. And that group of Raafidis said that the people of Paradise will come out of Paradise, and the people of Hell will come out of Hell, to wherever Allah wants to take them.” 
(al-Fasl 4/154, Dar al-Jeel edition) 
Al-Tahhaawi said in his ‘Aqeedah: “Paradise and Hell are two created entities that will never cease to exist or come to an end.” 
There is a great deal of evidence in the Quran and Sunnah to confirm this belief. For example, Allah says (interpretation of the meanings): 
“They will long to get out of the Fire, but never will they get out therefrom; and theirs will be a lasting torment”
[al-Maa'idah 5:37]
“(The torment) will not be lightened for them, and they will be plunged into destruction with deep regrets, sorrows and in despair therein”
[al-Zukhruf 43:75] 
“Their reward with their Lord is ‘Adn (Eden) Paradise (Gardens of Eternity), underneath which rivers flow. They will abide therein forever”
[al-Bayyinah 98:8] 
“No sense of fatigue shall touch them, nor shall they (ever) be asked to leave it [Paradise]”
[al-Hijr 15:48]
“And they will never get out of the Fire”
[al-Baqarah 2:167] 
“and they will not enter Paradise until the camel goes through the eye of the needle”
[al-A’raaf 7:40] 
“Neither will it have a complete killing effect on them so that they die nor shall its torment be lightened for them. Thus do We requite every disbeliever!”
[Faatir 35:36]
In the Sunnah, the Prophet (peace and blessings of Allah be upon him) said: “Death will come on the Day of Resurrection like a black and white ram, and it will stand between Paradise and Hell. It will be said, ‘O people of Paradise, do you recognize this?’ They will crane their necks and look, and will say, ‘Yes, it is death.’ 
It will be said, ‘O people of Hell, do you recognize this?’ They will crane their necks and look, and will say, ‘Yes, it is death.’ Then the command will be issued and it will be slaughtered. Then it will be said, ‘O People of Paradise, it is eternal and there is no death. O people of Hell, it is eternal and there is no death.’” Then the Messenger of Allah (peace and blessings of Allah be upon him) recited the verse (interpretation of the meaning): 
“And warn them (O Muhammad) of the Day of grief and regrets, when the case has been decided, while (now) they are in a state of carelessness, and they believe not”
[Maryam 19:39]
(Narrated by Muslim, 5087, from the hadeeth of Abu Sa’eed al-Khudri) 
This clear saheeh text leaves no room for doubt concerning this matter, which is that the people of Hell will abide therein forever, and will not die or come out, just as the people of Paradise will abide therein forever. 
The commentator of al-Tahhaawiyyah said: “Many reports of the Sunnah indicate that those who said Laa ilaaha ill-Allah will be brought forth from Hell. The ahaadeeth about intercession clearly indicate that the sinners among the people of Tawheed will be brought forth from Hell and that this applies only to them; if the kuffaar were to be brought forth from it, they would be like the believers, and that contradicts the exclusiveness indicated in the hadeeth.”
(Sharh al-Tahhaawiyyah, p. 430, al-Maktab al-Islami edition). 
With regard to the aayah (interpretation of the meaning): 
“They will abide therein for ages [ahqaab].
Nothing cool shall they taste therein, nor any drink.
Except boiling water, and dirty wound discharges”
[al-Naba’ 78:23-25]
what is meant, as al-Qurtubi (may Allah have mercy on him) said, is “They will stay in the Fire for as long as those ages last, and these ages will never cease. Every time one age ceases, another will come. Huqub means a lifetime or an age, and (the plural) ahqaab means ages. Hiqbah means a year, the plural of which is hiqab. Huqb means eighty years, or it was said that it means more than that, as we shall see, and the plural is ahqaab. The meaning in this verse is that they will abide therein for the ages of the Hereafter, to which there is no end. The verse does not specifically mention the Hereafter (by saying “the ages of the Hereafter”) because it is clear that the context here is speaking of the Hereafter. It is like saying the days of the Hereafter, days after days, without end. If it was referring to time it would have mentioned a specific length of time, such as five ages or ten ages, etc. The word ahqaab/huqub is used because that was the longest period of time according to the Arabs, so they would understand that. It is a metaphor for eternity, i.e., that they would abide therein forever. And it was said that ages (ahqaab) were mentioned rather than days because ahqaab is more indicative of eternity. These meaning are very similar. 
This eternal abiding is for the mushrikeen. The verse may also be interpreted as referring to the sinners who will be brought forth from Hell after these ages have passed. 
And it was said that ahqaab refers to the time when they will drink the hameem (boiling water) and ghasaaq (dirty wound discharges). When that comes to an end they will have another kind of punishment. Hence Allah says (interpretation of the meaning): 
‘They will abide therein for ages [ahqaab].
Nothing cool shall they taste therein, nor any drink.
Except boiling water, and dirty wound discharges’
[al-Naba’ 78:23-25].” 
(From Tafseer al-Qurtubi) 
With regard to the aayah: 
“As for those who are wretched, they will be in the Fire, sighing in a high and low tone.
They will dwell therein for all the time that the heavens and the earth endure, except as your Lord wills. Verily, your Lord is the Doer of whatsoever He intends (or wills).”
[Hood 11:106-107 – interpretation of the meaning]
Al-Qurtubi (may Allah have mercy on him) mentioned in his Tafseer eleven scholarly opinions, all of which indicate that the kuffaar will abide forever in Hell.  One of these opinions states that the exception applies only to the sinners among the believers, who will be brought forth from Hell after some time. On this basis, the phrase ‘As for those who are wretched’ is general and applies to both kaafirs and sinners, and the exception refers to the word ‘khaalideena [translated here as dwell therein for all the time]’. In al-Saheeh it is narrated that Anas ibn Maalik said: The Messenger of Allah (peace and blessings of Allah be upon him) said: “Some people will enter Hell, then when they are like ashes, they will be brought forth from it and admitted to Paradise, and it will be said, ‘These are the Jahannamiyyeen (the hellish ones).’”
(Narrated by al-Bukhaari, 6896). 
Another view is that illa (except) here [ in the phrase translated as They will dwell therein for all the time that the heavens and the earth endure, except as your Lord wills] means siwa (apart from), as in the phrase ma ma’i rajulun illa Zayd (there is no man with me apart from Zayd). So the meaning here is: so long as the heavens and the earth endure, apart from (or in addition to) the eternity which Allah wills they should abide therein. 
We have refrained from quoting all the opinions here for the sake of brevity, but the reader may benefit from referring to them. 
Hence we may note that the teaching of the Quran and Sunnah, and scholarly consensus (ijmaa’), that Hell and its people will remain forever, is not contradicted by any clear saheeh text of the Book of Allah or the Sunnah of His Messenger, or by any report from the Sahaabah and Taabi’een. 
So this is the answer to your question, “Or will their punishment last for ages the length of which is known to Allah, and if so, what will their fate be after that, is there any reference to that in the Quran or Sunnah?” 
We may add here that in the texts that we have quoted and in others that we have not mentioned, there is evidence to confirm the beliefs of Ahl al-Sunnah in this matter. The fact that the texts do not say anything about their fate after those ages proves what we have mentioned, that those ages will not come to an end. May Allah protect us and you from that. 
There is nothing in what we have mentioned that contradicts the mercy and justice of Allah. Rather this is what is implied by His justice and mercy, as Allah says (interpretation of the meaning): 
“But those who disbelieve (in the Oneness of Allah — Islamic Monotheism), for them will be the fire of Hell. Neither will it have a complete killing effect on them so that they die nor shall its torment be lightened for them. Thus do We requite every disbeliever!
Therein they will cry: ‘Our Lord! Bring us out, we shall do righteous good deeds, not (the evil deeds) that we used to do.’ (Allah will reply:) ‘Did We not give you lives long enough, so that whosoever would receive admonition could receive it? And the warner came to you. So taste you (the evil of your deeds). For the Zaalimoon (polytheists and wrongdoers) there is no helper.’”
[Faatir 35:36-37]
“Verily, the Mujrimoon (criminals, sinners, disbelievers) will be in the torment of Hell to abide therein forever.
(The torment) will not be lightened for them, and they will be plunged into destruction with deep regrets, sorrows and in despair therein.
We wronged them not, but they were the Zaalimoon (polytheists, wrongdoers).
And they will cry: ‘O Malik (Keeper of Hell)! Let your Lord make an end of us’  He will say: ‘Verily, you shall abide forever.’
Indeed We have brought the truth (Muhammad with the Quran) to you, but most of you have a hatred for the truth”
[al-Zukhruf 43:74-78] 
“Shall We then treat the Muslims (believers of Islamic Monotheism, doers of righteous deeds) like the Mujrimoon (criminals, polytheists and disbelievers)?
What is the matter with you? How judge you?”
[al-Qalam 68:34-35] 
“Or do those who earn evil deeds think that We shall hold them equal with those who believe (in the Oneness of Allah Islamic Monotheism) and do righteous good deeds, in their present life and after their death? Worst is the judgement that they make.
And Allah has created the heavens and the earth with truth, in order that each person may be recompensed what he has earned, and they will not be wronged”
[al-Jaathiyah 43:21-22]
“To Him is the return of all of you. The Promise of Allah is true. It is He Who begins the creation and then will repeat it, that He may reward with justice those who believed and did deeds of righteousness. But those who disbelieved will have a drink of boiling fluids and painful torment because they used to disbelieve”
[Yoonus 10:4]
 Whoever ponders these blessed verses will be certain that Allah is All-Wise, All-Knowing, Most Merciful, and He does not wrong any soul in the slightest. Your Lord is not unjust towards His slaves and
 
“He cannot be questioned as to what He does, while they will be questioned”
[al-Anbiya’ 21:23 – interpretation of the meaning]
 And Allah knows best.