Messenger of Allah (ﷺ) said, "Command your children to perform Salat (prayer) when they are seven years old, and beat them for (not offering) it when they are ten, and do not let (boys and girls) sleep together". [Abu Dawud, who categorized it as Hadith Hasan with a Hasan Chain].
" مروا أولادكم بالصلاة وهم أبناء سبع سنين، واضربوهم عليها، وهم أبناء عشر، وفرقوا بينهم في المضاجع"