And He—exalted be He—also says: “So glorify Allah when you enter the evening and when you rise in the morning; and to Him belongs all praise in the heavens and on earth—at nightfall and when the day begins to decline” (Qur’an 30:17-18).
Thus, when the time of a given prayer arrives for a person who is legally adult and of sound mind, that prayer becomes obligatory for him—except in the case of a menstruating woman or one in post-partum bleeding, for it is not incumbent upon either of them, nor must they make it up once they regain purity, by unanimous agreement. Anyone whose mind is absent because of sleep, fainting, or similar causes must perform the missed prayer as soon as he regains consciousness.
Allah the Most High likewise says: “Establish the prayer for My remembrance” (Qur’an 20:14).
The Prophet said, “Whoever sleeps through a prayer or forgets it, let him perform it when he remembers it,” narrated by Muslim.
The guardian of a minor must command the child to pray once the child reaches seven years of age, even though the prayer is not yet obligatory for him, so that he will take it seriously, grow accustomed to it, and so that a reward will be recorded for both him and his guardian whenever he prays. This is based on the general meaning of Allah’s words: “Whoever brings a good deed shall receive ten times its like” (Qur’an 6:160), and on the Prophet’s response when a woman lifted up a small child and asked, “Is there pilgrimage for this one?” He replied, “Yes, and you will have a reward.” Hence the guardian teaches the child both the prayer and the purification required for it.
If, after reaching ten years of age, the child becomes negligent regarding the prayer, the guardian must discipline him with a beating, in accordance with the hadith: “Command your children to pray when they are seven years old; beat them for it when they are ten, and separate them in their beds,” narrated by Ahmad, Abu Dawud, al-Tirmidhi, and others.