It goes without saying that Prayer is the pillar of Islam, the pinnacle of good deeds, and the peak of obedience. `Uthman ibn `Affan (may Allah be pleased with him) reported that the Prophet (peace be upon him) said: “If the time for a prescribed Salah comes, and a Muslim performs wudu’ (ablution) properly (and then offers his Salah) with humility and bowing (to Allah), it will be an expiation for his past sins, so long as he has not committed a major sin; and this is applicable to all times.” (Muslim)
There is a fatwa issued by Al-Azhar House of Fatwa in this regard:
It is unanimously agreed upon among scholars that prayer is obligatory upon Muslims and that Muslim parents are to order their children when they are seven years old to perform it, but if the children have reached ten years old without observing prayer, their parents are to beat them for that. Beating in that case is to be with the hand, not a harmful instrument. There is a Hadith to that effect: “Order your children to perform Salah when they are seven years old, and beat them (if they have neglected it) when reaching ten years old. And separate between your male and female children in bed.” (Ahmad)
The one who denies that obligatory prayer is obligatory is regarded as an unbeliever, for the prayer is one of the pillars of Islam, and the evidence for this is clear cut. There is a scholarly consensus upon that.
As for the one who holds that the prayer is obligatory, but he abandons it out of lack of concern (as it is the case of many Muslim people), there is a scholarly difference as to judging him.
According to the majority of the righteous Muslim predecessors and the majority of the righteous successors, including imams Malik and Ash-Shafi`i, whoever does so is not to be regarded as an unbeliever; rather, he is to be regarded as a sinner. Accordingly, if he repents, he will save himself from severe punishment, and if he does not, he will be executed for committing a sin punishable by death, as it is the case with a married person who commits adultery. According to those scholars, executing the person who abandons prayer in that case is to be by cutting his head off with a sword.
Another group of the righteous predecessors believed that the one who abandons prayer while still believing it to be obligatory is to be considered an unbeliever. Such an opinion was attributed to `Ali ibn Abi Talib (may Allah be pleased with him).
Such point of view was also reported to have been said by Imam Ahmad ibn Hanbal (may Allah have mercy upon him),Yet there was another opinion in that regard also reported to have been said by Imam Ahmad. Some of the followers of imam Ash-Shafi`i held that opinion, too.
Imam Abu Hanifah, a group of the Kufic scholars, and Al-Mazni, a follower of Imam Ash-Shafi`i, are of the opinion that the one who holds that prayer is obligatory yet neglects observing it is not to be considered an unbeliever, nor is he to be executed. Rather, he is to be punished with a punishment that the judge sees appropriate to his case, and he is to be imprisoned until he performs prayer. It was also said that he is to be beaten until he agrees to perform prayer, or he is to be beaten until he bleeds and agrees to pray.
Each of the above opinions cited evidence to support its point of view. Some of these pieces of evidence are quotations from the Qur’an and some are hadiths of Prophet (peace be upon him).
As for our point of view in that regard, we recommend adopting the opinion of imam Abu Hanifah, that is, that the one who abandons prayer out of lack of concern yet still holds that it is obligatory is not to be regarded as an unbeliever, nor is he to be executed for insisting to neglect it; rather, he is to be imprisoned and punished until he performs it. We recommend that opinion, for it is not a severe one.
As to the suggestion that the Muslim governments are to oblige the people to perform Salah, it is up to the rulers in authority to decide what to do in that concern according to the general benefit of the people.”