Those who say that the one who does not pray is a kaafir and those who say that he is not a kaafir both claim that there is consensus on their point of view; how are we to understand the claim of consensus on both their parts?
Question

I have read the scholars’ opinions on the one who does not pray. Some of them say that he is a kaafir and an apostate, and some say that he is an evildoer (faasiq). The first group claims that there is consensus on this point. My question is: if there is consensus concerning this issue, then why did Abu Haneefah, Maalik and ash-Shaafa‘i not hear of it? Why did they not say that there was consensus? In fact I have even heard that Imam Ahmad, in one of the reports narrated from him, agreed with the other three. I have also read that Imam ash-Shawkaani stated that the consensus of the salaf (early generations) was that the one who does not pray is not a kaafir. So where did the first group get the claim that there is consensus on this issue? Why was this consensus unknown to all those scholars who disagreed with them?
Praise be to Allah.If the one who does not pray does not do it because he denies that it is obligatory, even though he is aware that Allah has commanded that prayer be established, then he is a kaafir and an apostate according to the consensus of the ummah. 
If a person does not pray because he denies that it is obligatory out of ignorance on his part that it is obligatory, such as one who is new in Islam, he is not deemed to be a kaafir, but he is to be taught and instructed to pray. 
Ibn ‘Abd al-Barr (may Allah have mercy on him) said: 
The Muslims are unanimously agreed that the one who denies that prayer is obligatory is a kaafir who is to be executed if he does not repent from that kufr. However they differed concerning the one who affirms that it is obligatory but deliberately does not do it even though he is able to.
End quote from al-Istidhkaar, 2/149 
Ibn Qudaamah (may Allah have mercy on him) said: 
The one who does not pray must either deny that it is obligatory or not deny that this is the case. If he denies that it is obligatory, he must be examined further. If he is unaware of that, then he is one of those who are ignorant of that, such as one who is new in Islam or who grew up in the wilderness. He is to be informed and taught that it is obligatory, and he is not to be deemed a disbeliever, because he is excused. If he is not one of those who were unaware of that, such as one of those who grew up among the Muslims in Muslim regions and cities, then he is not to be excused and his claim of having been ignorant is not to be accepted from him, and he is to be deemed a disbeliever, because the evidence for it being obligatory is clear from the Qur’an and Sunnah, and the Muslims offer the prayer constantly, so in this case it is basically obvious that it is obligatory, and he is only denying it because he disbelieves in Allah, may He be exalted, and in His Messenger and the consensus of the ummah. This person has become an apostate from Islam and is subject to the same ruling as all other apostates: he is to be asked to repent and to be executed if he does not repent. I do not know if any difference of opinion concerning this matter.
End quote from al-Mughni, 2/156 
The one who does not pray out of heedlessness concerning it and out of a lack of regard for its importance is the one concerning whom the scholars differed. Some of them ruled that he is a disbeliever and others ruled that he is not a disbeliever; some ruled that he is a disbeliever if he does not pray at all, but if he prays sometimes and does not pray at other times, then he is not to be deemed a disbeliever. 
It says in al-Mawsoo‘ah al-Fiqhiyyah (27/53-54): 
The Maalikis and Shaafa‘is are of the view that the one who does not pray out of carelessness and laziness, not because he denies that it is obligatory, is to be executed as a hadd punishment, i.e., after death he comes under the same ruling as other Muslims, so he is to be washed (ghusl), the funeral prayer is to be offered for him and he is to be buried with the Muslims. 
The Hanbalis are of the view that the one who does not pray out of laziness is to be advised to do it and he should be told: If you pray, all well and good, otherwise we will execute you. Then if he prays, all well and good, otherwise he must be executed. But he is not to be executed until he has been detained for three days and called at the time of every prayer. Then if he prays, all well and good, otherwise he is to be executed as a hadd punishment or, it was said, he is to be executed for his disbelief, which means that he is not to be washed, the funeral prayer is not to be offered for him, and he is not to be buried in the Muslim graveyard. However he is not to be enslaved and his family and children are not to be taken captive, like other apostates. End quote. 
Ibn ‘Uthaymeen (may Allah have mercy on him) said: 
What appears to me to be the case is that he does not become a disbeliever unless he does not pray altogether, i.e., he never prays; as for the one who prays sometimes, he is not a disbeliever.
End quote from Majmoo‘ Fataawa Ibn ‘Uthaymeen, 12/55 
See also the answer to questions no. 5208 and 83165
More than one of the scholars have stated that there was consensus that the one who does not pray becomes a disbeliever. Ishaaq ibn Raahawayh said: This is the opinion of the scholars from the time of the Prophet (blessings and peace of Allah be upon him) until our present time.
End quote from al-Istidhkaar, 2/150 
They quoted as evidence the apparent meaning of the texts that described him as a disbeliever, and the words of ‘Abdullah ibn Shaqeeq al-‘Uqayli: The Companions of Muhammad (blessings and peace of Allah be upon him) did not think that failing to do any action constituted disbelief except in the case of prayer.
Narrated by at-Tirmidhi (2622); classed as saheeh by al-Albaani in Saheeh at-Tirmidhi 
See also the answer to question no. 9400 
Those who differed from them narrated that there was consensus that he does not become a disbeliever. They said: 
That is the consensus of the Muslims. We do not know of anyone, during any period, among those who did not pray, who was not washed or the funeral prayer was not offered for him or he was not buried in the Muslim graveyard, or his heirs were prevented from inheriting from him or he was prevented from inheriting from his Muslim relatives, if they died, and there was no separation between spouses if one of them did not pray, even though there were many such people. If (the one who does not pray) was indeed a disbeliever, then all of these rulings would have been applied. We do not know of any difference of opinion among the Muslims concerning the fact that the one who does not pray is obliged to make them up; if he was an apostate, he would not be obliged to make up his prayers and fasts (after repenting). With regard to the hadeeths which say that he is a disbeliever, they are to be understood as highlighting the seriousness of failing to pray, and likening the one who does that to the disbelievers; they are not to be understood literally. This is like the hadeeth of the Prophet (blessings and peace of Allah be upon him), “Reviling a Muslim is evildoing and fighting him is disbelief (kufr)” and “The one who drinks alcohol is like one who worships an idol” and so on. What is meant in these hadeeths is to issue a stern warning.
See al-Mughni, 2/157 
Such matters may be a case of ijtihaad on both sides. The first group thought that the words of ‘Abdullah ibn Shaqeeq quoted above appeared to mean that there was consensus among the Sahaabah that the one who does not pray is a disbeliever, therefore they narrated that there was consensus. 
The other group thought that the actions of Muslims during all eras – namely washing the one who did not pray, offering the funeral prayer for him, burying him in the Muslim graveyard, and so on – were an indication of consensus among the Muslims that he (the one who does not pray) is not a disbeliever. And they thought that the hadeeths which appear to mean that he is a disbeliever were intended to highlight the seriousness of not praying and to warn against it. This includes the report of ‘Abdullah ibn Shaqeeq. 
The matter is one concerning which there is a difference of opinion; as the scholars differed concerning the texts and the understanding thereof, they also differed concerning what seemed to indicate that there was consensus. It cannot be said that if one group quoted shar‘i texts as evidence, how can the other group have been unaware of those texts?, because the texts were not hidden from them, but they differed in their understanding of them and the rulings they pointed to. Something similar may be said with regard to the matter of consensus; those who said that the one who does not pray is not a disbeliever are not denying these hadeeths or rejecting the words of Ibn Shaqeeq quoted above, but they think that these texts – even though the word kufr (disbelief) was used to describe the one who does not pray – do not mean that he is a disbeliever in the sense of disbelief that puts him beyond the pale of Islam. Hence this issue is one of the issues in which there a difference of opinion is acceptable. 
The first group narrated that there was consensus based on the apparent meaning of the texts, of which no one disputes the soundness, and on the words of Ibn Shaqeeq and Ishaaq ibn Raahawayh, and so on. 
The second group narrated that there was consensus on the basis of what they saw of the actions of the ummah in all times and places. 
If either of these two groups had been convinced of the other’s claim that there was consensus, and had agreed that it was well-founded, then they would have gone along with them. But the problem in this case was that neither group accepted the claim of consensus of the other. 
And Allah knows best.