No good deeds will be accepted from one who does not pray – no zakaah, no fasting, no Hajj or anything else.
Al-Bukhaari (520) narrated that Buraydah said: The Messenger of Allaah (peace and blessings of Allaah be upon him) said: “Whoever does not pray ‘Asr, his good deeds will be annulled.”
What is meant by “his good deeds will be annulled” is that they will be rendered invalid and will be of no benefit to him. This hadeeth indicates that Allaah will not accept any good deed from one who does not pray, so the one who does not pray will not benefit at all from his good deeds and no good deed of his will be taken up to Allaah.
It seems from the hadeeth that there are two types of those who do not pray: those who do not pray at all, which annuls all their good deeds, and those who do not offer a particular prayer on a particular day, which annuls the good deeds of that day. So annulment of all good deeds happens to those who forsake all the prayers, and annulment of the good deeds of a particular day happens to the one who omits a particular prayer.
Shaykh Ibn ‘Uthaymeen was asked in Fataawa al-Siyaam (p. 87) about the ruling on the fasting of one who does not pray.
The fast of one who does not pray is not valid and is not accepted, because the one who does not pray is a kaafir and an apostate, because Allaah says (interpretation of the meaning):
“But if they repent [by rejecting Shirk (polytheism) and accept Islamic Monotheism], perform As-Salaah (Iqaamat-as-Salaah) and give Zakaah, then they are your brethren in religion”
And the Prophet (peace and blessings of Allaah be upon him) said: “Between a man and shirk and kufr stands his giving up prayer.” Narrated by Muslim, 82. And he (peace and blessings of Allaah be upon him) said: “The covenant that separates us from them is prayer; whoever gives up prayer is a kaafir.” Narrated by al-Tirmidhi, 2621; classed as saheeh by al-Albaani in Saheeh al-Tirmidhi.
This is also the view of most of the Sahaabah, if not their consensus. ‘Abd-Allaah ibn Shaqeeq (may Allaah have mercy on him), who was one of the well-known Taabi’een, said: The companions of the Prophet (peace and blessings of Allaah be upon him) did not think that omitting any action made a person a kaafir, except for prayer. Based on this, if a person fasts but he does not pray, then his fast is rejected and not accepted, and it will not avail him anything before Allaah on the Day of Resurrection. We say to him: Pray then fast, because if you fast but do not pray, then your fast will be rejected, because acts of worship are not accepted from a kaafir.
The Standing Committee (10/140) was asked: if a person is keen to fast in Ramadaan and to pray in Ramadaan only, but he stops praying as soon as Ramadaan is over, does his fasting count?
Prayer is one of the pillars of Islam, and it is the most important pillar after the Shahaadatayn. It is an individual obligation (fard ‘ayn), and whoever does not do it because he denies that it is obligatory, or he does not do it because he is careless and lazy, is a kaafir. With regard to those who fast Ramadaan and pray in Ramadaan only, this is trying to cheat Allaah, and unfortunate indeed are those who only acknowledge Allaah in Ramadaan. Their fasting is not valid if they do not pray at times other than Ramadaan, rather this makes them kaafirs in the sense of major kufr (kufr akbar), even if they do not deny that prayer is obligatory, according to the more sound of the two scholarly opinions.