He didn’t know it was against the law because the mandate to beat one’s wife is in the Qur’an:
“Men have authority over women because Allah has made the one superior to the other, and because they spend their wealth to maintain them. Good women are obedient. They guard their unseen parts because Allah has guarded them. As for those from whom you fear disobedience, admonish them and send them to beds apart and beat them.” — Qur’an 4:34
Muhammad “struck me on the chest which caused me pain, and then said: Did you think that Allah and His Apostle would deal unjustly with you?” — Aisha (Sahih Muslim 2127)
The story is online here, but it’s behind a subscription wall.
(Thanks to Marc.)