It is narrated from Sabrah (bin Ma’bad Juhani) that the Messenger of Allah (peace be upon him) said: "Teach the child to pray when he is seven years old, and when he is ten years old, beat him for (not) praying."
Hadith Referenceسنن دارمي / من كتاب الصللاة / 1469
Hadith Takhrijاس حدیث کی یہ سند حسن ہے، لیکن بمجموع طرق صحیح کے درجہ کو پہنچتی ہے۔ دیکھئے: [أبوداؤد 494] ، [ترمذي 407] ، [طبراني 6546] ، [مشكل الآثار للطحاوي 231/3] ، [ابن خزيمه 1002] ، [الحاكم 258/1 وغيرهم]
Brief Explanation
(Commentary on Hadith 1468)
It is established from this hadith that when a child reaches the age of seven, he should be taught to perform prayer (salah) so that he becomes accustomed to it. And when he reaches the age of ten and does not pray, then he should be disciplined (by beating).
It should be clear that this ruling applies to girls as well. It is obligatory upon their guardians to implement this command. Nowadays, people beat their sons and daughters for acting against their wishes, but if they do not pray, no one says anything to them, because most parents themselves do not perform prayer. May Allah grant guidance to everyone.