Purification of the sinners
Question

I've heard that, after the judgement day the moslem, excluded the syahid and moslem who were guaranted by Allah to go to heaven, before they go to the heaven they would be cleaned. I mean, they would go to hell first then after they have been cleaned up they would go to heaven.Is it true?.
Praise be to Allah.Firstly: 
Perhaps the questioner is referring to the verse in which Allah says (interpretation of the meaning): 
“There is not one of you but will pass over it (Hell); this is with your Lord, a Decree which must be accomplished.
Then We shall save those who use to fear Allah and were dutiful to Him. And We shall leave the Zaalimoon (polytheists and wrongdoers) therein (humbled) to their knees (in Hell)” [Maryam 19:71-72]
This is addressed to all of mankind, righteous and immoral, believers and kaafirs, stating that there is not any one among them who will not pass over Hell, a decree which Allah has issued and of which He has warned His slaves. So it must inevitably come to pass, and there is no avoiding it.  
The scholars differed as to the meaning of this passing over. Some said that it means that Hell will be brought close to all creatures, until it terrifies all of them, then Allah will save those who fear Him. 
Some said that it means that all will enter it, but it will be coolness and safety for the believers. 
Some said that it means crossing the siraat which is a bridge over Hell. The people will cross it according to their deeds: some will cross it in the twinkling of an eye, some like the wind, some like swift horses; some will pass quickly, some will walk, some will crawl and some will be snatched  and thrown into the Fire, all according to their level of fear of Allah. Hence Allah says “Then We shall save those who used to fear Allah and were dutiful to Him” i.e., by doing what He commanded and avoiding what He forbade; “And We shall leave the Zaalimoon (polytheists and wrongdoers)” i.e., those who wronged themselves by disbelieving and committing sin, “therein (humbled) to their knees (in Hell)” – this is because of the wrongdoing and kufr, so they will deserve to abide therein forever and there will be no way out for them."(Tafseer Ibn Sa’di, p. 811) 
Secondly: 
It is essential for those who will be admitted to Paradise to be cleansed of all their sins before they enter it. The sinners’ cleansing of their sins may happen in this world or in the Hereafter. In this world, Allah has given His slaves ways of cleansing themselves thereof, by following their sins and evil deeds with prayers for forgiveness, sincere repentance and good deeds that erase sin. We have already discussed this matter in the answer to question no. 13693. 
With regard to the purification of the sinners in the Hereafter, this will be achieved in several ways: 
1 – Prayers of the believers for the (deceased) believer, such as their offering the funeral prayer for him. It was narrated from ‘Aa’ishah and Anas ibn Maalik that the Prophet (peace and blessings of Allah be upon him) said: “There is no deceased person for whom a group of Muslims numbering one hundred offer the funeral prayer, all of them interceding for him, but their intercession for him will be accepted.” Narrated by Muslim, 947. 
It was narrated that Ibn ‘Abbaas (may Allah be pleased with him) said: I heard the Messenger of Allah (peace and blessings of Allah be upon him) say: “There is no Muslim man who dies and forty men who do not associate anything in worship with Allah stand and pray for him, but Allah will accept their intercession for him.” Narrated by Muslim, 948. 
So it is known that this du’aa’ is one of the means of the deceased being forgiven. 
2 – Acts of ongoing charity that the person did during his life will benefit him after his death. 
3 – Good deeds done on behalf of the deceased, such as charity, Hajj, etc. These will benefit him, according to the texts of the saheeh Sunnah. It was proven in al-Saheehayn that the Prophet (peace and blessings of Allah be upon him) said: “Whoever dies owing fasts, let his heir fast on his behalf.” And it was narrated from Abu Hurayrah that the Messenger of Allah (peace and blessings of Allah be upon him) said: “When a man dies all his good deeds come to an end except three: ongoing charity, beneficial knowledge and a righteous child who will pray for him.” Narrated by Muslim, 1638. 
4 – What happens in the grave of the trial, squeezing and terror. These are things that expiate for sins. 
5 – The intercession of the Prophet (peace and blessings of Allah be upon him) and others for sinners on the Day of Resurrection, as is narrated in mutawaatir reports in the ahaadeeth about intercession, such as the words of the Prophet (peace and blessings of Allah be upon him) in the saheeh hadeeth, “My intercession will be for those among my ummah who committed major sins,” and “I was given the choice between admitting half of my ummah to Paradise and intercession, and I chose intercession because it is more general and greater. Do you think it will be only for the pious? No, it will be for the sinners who contaminated themselves with sins.” Narrated by Ibn Maajah 4311; classed as saheeh by al-Albaani in Saheeh Ibn Maajah, 3480. 
6 – The terrors, difficulties and hardships of the Day of Resurrection.  
7 – The mercy and forgiveness of Allah bestowed with no action on the part of His slaves. It was narrated that Abu Hurayrah (may Allah be pleased with him) said: I heard the Messenger of Allah (peace and blessings of Allah be upon him) say: “Allah created mercy on the day that He created it, and divided it into one hundred parts. He kept ninety-nine parts and sent one to all of His creation. If the kaafir knew of all that is with Allah of mercy, he would never despair of Paradise, and if the believer knew of all that is with Allah of punishment he would never feel safe from Hell.”
Narrated by al-Bukhari, 6469. 
And the Messenger of Allah (peace and blessings of Allah be upon him) said: “Allah will draw the believer close and screen him and will say, ‘Do you admit such and such sin, do you admit such and such sin?’ and he will say, ‘Yes, O Lord.’ Then when he has admitted his sins and thinks that he is doomed, [Allah] will say, ‘I concealed them for you in the world and I forgive you for them this Day.’ Then he will be given the book of his good deeds. But as for the kaafir and the hypocrite, “the witnesses will say, “These are the ones who lied against their Lord!” No doubt! the Curse of Allah is on the Zaalimoon (polytheists, wrongdoers, oppressors)’ [Hood 11:18 – interpretation of the meaning]”
Narrated by al-Bukhari, 2441. 
8 – It is proven in al-Saheehayn that when the believers have crossed al-Siraat, they will be detained on a bridge between Paradise and Hell, where they will settle their scores with one another. Then when they have been cleansed and purified, they will be given permission to enter Paradise. It was narrated that Abu Sa’eed al-Khudri (may Allah be pleased with him) said: The Messenger of Allah (peace and blessings of Allah be upon him) said: “When the believers have been saved from the Fire, then they will be detained on the bridge between Paradise and Hell. There they will settle the scores between them for any wrongs that they did to one another in this world, and when they have been cleansed and purified, they will be given permission to enter Paradise. By the One in Whose hand is the soul of Muhammad, each of them will recognize his dwelling in Paradise better than he recognizes his dwelling in this world.” Narrated by al-Bukhari, 6535. 
Al-Haafiz Ibn Hajar (may Allah have mercy on him) said: 
“When the believers have been saved from the Fire” means when they have been saved from falling into it after they have crossed al-siraat. 
Al-Qurtubi said: These believers are the ones whom Allah knows that settling scores will not use up all of their good deeds. 
I (al-Haafiz) say: Perhaps the people of al-A’raaf are among them, according to the more correct opinion referred to above. Excluded from this are two groups of believers: those who will enter Paradise without being brought to account, and those who are doomed by their deeds. 
“they will be detained on the bridge between Paradise and Hell” – al-siraat is a bridge placed across Hell, and Paradise lies beyond that. So the people will pass across it according to their deeds. Among them will be those who are saved, who are the ones whose good deeds outweigh their bad deeds, or they are equal, or Allah has forgiven them. Some of them will fall into Hell, and they are the ones whose bad deeds outweigh their good deeds, except for those whom Allah forgives. Those believers in Tawheed who fall will be punished for as long as Allah wills, then they will be brought out by intercession and other means. The ones who are saved may have some scores which others need to settle with him, but they have good deeds that equal that or outweigh it, so some of their good deeds equivalent to those scores that need to be settled, and thus is will becomes free of responsibility.  
“and when they are cleansed and purified” means cleansed and freed of all responsibilities. End quote. 
If the Muslim who believed in Allah alone but committed sins is not cleansed for some reason, then he will enter Hell so that he may be purified completely therein, but he will not abide therein forever, rather he will be brought forth by the intercession of those who intercede and by the mercy of the Most Merciful of those who show mercy. 
Shaykh ‘Abd al-‘Azeez ibn Baz (may Allah have mercy on him) said: 
With regard to the sinners, such as those who kill unlawfully, those who disobey their parents, those who consume riba, and those who drink alcohol – if they die in those sins and they are Muslims, they and others like them will be subject to the will of Allah, as Allah says (interpretation of the meaning): 
“but He forgives whom He pleases sins other than that” [al-Nisa’ 4:116]
 So if He wills He will forgive them because of the righteous deeds with which they died, which is their belief in Him alone (Tawheed) and their sincerity towards Allah, and their being Muslims, or the intercession of those who intercede for them, as well as their Tawheed and sincerity. 
Or He may punish them without forgiving them, so they are punished by being admitted to Hell and tormented therein, to a degree commensurate with their sins, then they will be brought forth, as is stated in mutawaatir ahaadeeth narrated from the Messenger of Allah (peace and blessings of Allah be upon him), which say that he will intercede for the sinners among his ummah, and that Allah will give him a certain number of people a number of times, so he will intercede and bring forth a group by Allah’s leave, then he will intercede again, and again and again, so he will (peace and blessings of Allah be upon him) will intercede four times. And the angels and the believers will also intercede, as will al-afraat (the children who died before they reached the age of puberty). All of them will intercede and Allah will bring forth whomever He wills from Hell through their intercession.  Then there will be some of the sinners from among the believers in Tawheed and Islam left in Hell. Then the Lord will bring them forth by His grace and mercy, without intercession on anyone’s part, and there will be no one left in Hell except those whom the Qur’aan rules will abide therein forever, namely the kuffaar."(Majmoo’ Fatawa wa Maqaalaat Ibn Baz, 9/380). 
It was narrated that Abu Hurayrah said: The Messenger of Allah (peace and blessings of Allah be upon him) said: “… until when Allah has finished passing judgement amongst His slaves, and He wants to bring forth from Hell those whom He wants of those who used to testify that there is no god except Allah, He will command the angels to bring them forth and they will know them by the traces of the mark of sujood. Allah will forbid the Fire to consume the mark of sujood on the sons of Adam. So they will bring them forth and they will have been burned, then water that is called the water of life will be poured on them, and they will grow like seeds growing after a flood recedes.” 
Narrated by al-Bukhari, 6574; Muslim, 172. 
It was narrated that Abu Sa’eed said: The Messenger of Allah (peace and blessings of Allah be upon him) said: “As for the people of Hell who belong there, they will neither die nor live therein, but people who entered Hell because of their sins, they will die once, then when they have become like coals, permission will be given for intercession, so they will be brought forth group after group and scattered on the rivers of Paradise, then it will be said, ‘O people of Paradise be generous to them, then they will grow like seeds growing after a flood recedes.” 
Narrated by Muslim, 185. 
We ask Allah to bestow His mercy upon us, and to forgive us. Praise be to Allah the Lord of the Worlds. 
And Allah knows best. 
References: 
Fatawa Ibn Taymiyah, 7/498-501; Minhaaj al-Sunnah, 6/238; Fath al-Bari, 11/406; al-Bihar al-Zaajirah, 242;