Praise be to Allaah.
Abu Dawood (459) and Ahmad (6650) narrated from ‘Amr ibn Shu’ayb from his father that his grandfather said: The Messenger of Allaah (blessings and peace of Allaah be upon him) said: “Teach your children to pray when they are seven years old, and smack them if they do not pray when they are 10 years old, and separate them in their beds.” Classed as saheeh by al-Albaani in al-Irwa’ (247).
Ibn Qudaamah (may Allaah have mercy upon him) said in al-Mughni (1/357):
This telling and discipline is prescribed in the case of children in order to train them to pray, so that they will be used to it and it will become their habit, and they will not forsake it when they reach puberty. End quote.
Al-Subki said:
The guardian must tell the child to pray when he is seven years old and smack him if he does not do so when he is 10.
We think we should enjoin what is not obligatory and smack for failing to do that which is not obligatory. We smack animals for disciplinary purposes, so what about children? That is in the child's interests, and so that he will get used to praying before he reaches puberty. End quote.
Fataawa al-Subki, 1/379
So boys and girls are to be told to pray when they are seven years old and are to be smacked if they do not pray when they reach the age of 10. Similarly they are to be told to fast Ramadan and should be encouraged to do good things, such as reading Qur’aan, offering supererogatory prayers, Hajj and ‘umrah, and reciting a lot of tasbeeh, tahleel, takbeer and tahmeed, and they should be prevented from committing all kinds of sin.
Shaykh Ibn Baaz (may Allaah have mercy on him) said:
Take care of the members of your household and do not neglect them, O slave of Allaah. You have to strive hard in their best interests, and tell your sons and daughters to pray at the age of seven, and smack them if they do not do so when they are 10, a light smack that will help them to obey Allaah and make them get used to offering prayers on time, so that they will adhere properly to the religion of Allaah and know the truth, as is narrated in saheeh reports from the Messenger of Allaah (blessings and peace of Allaah be upon him). End quote.
Majmoo’ Fataawa Ibn Baaz (6/46).
It should also be noted that disciplining a child should not be done only for neglecting to pray; rather it should also be done if he is careless about the conditions, essential parts and obligatory duties of prayer. A child may pray, but he combines prayers, or he prays without wudoo’, or he does not pray properly. So he must be taught everything about it, and we should make sure that he is aware of its obligatory duties, essential parts and conditions, then if he neglects any of these things, we must advise him and teach him time after time, then if he persists he may be disciplined by means of smacking until he prays properly.
And Allaah knows best.