Answer
Wa `alaykum As-Salamu waRahmatullahi wa Barakatuh.
In the Name of Allah, Most Gracious, Most Merciful.
All praise and thanks are due to Allah, and peace and blessings be upon His Messenger.
With regard to the hadith about beating children to prayer, it is best to translate the word idribuhum as spanking or even better as disciplining rather than hitting.
Answering your question, Sheikh Ahmad Kutty, a Senior Lecturer and an Islamic Scholar at the Islamic Institute of Toronto, Ontario, Canada, states:
With regard to the hadith you mentioned in your question, it is best to translate the word idribuhum as spanking or even better as disciplining rather than hitting.
To infer from this that Islam allows corporal punishment as a method of teaching is repugnant to the spirit of the Sunnah as we can safely establish from a close study of the Seerah and the Prophetic traditions.
As we learn from his beloved wife `A’ishah, the Prophet (peace be upon him) never hit anyone: neither a man or woman, young or old.” (Ibn Hibban and At-Tabarani)
Anas (may Allah be pleased with him) who accompanied the Prophet (peace be upon him) from the age of ten said, “I served the Messenger of Allah for ten years and yet during the entire course of time not even once he condemned me for any mistake I made!” (At-Tirmidhi and others)
In other words, his method of mentoring was by setting examples, practice, and character.
It is for this reason that Allah orders us to emulate his beautiful examples.
For more, see these posts:
How to Discipline a Stubborn Child?
6 Tips to Strengthen Children’s Connection with Quran
Useful Tips for Teaching Children Effectively
Allah Almighty knows best.