All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad, sallallaahu ‘alayhi wa sallam, is His Slave and Messenger.
The Hadeeth that forbids beating wives is reported in Sunan Abu Daawood on the authority of Iyaas ibn ‘Abdullaah ibn Abi Thubaab who said: “The Prophet said: "Do not beat the female slaves of Allaah.” So, ‘Umar said: “The wives have become very daring towards their husbands. So the Prophet permitted beating them. Then, many wives complained to the wives of the Prophet about their husbands beating them. Thereupon, the Prophet said: “Indeed, many women complained to Aal Muhammad (i.e. to his wives) about their husbands [who beat them]; those [husbands] are not the best among yourselves.”
Abu Daawood wrote a chapter about this entitled: Chapter about beating wives.
This Hadeeth as you see does not mention what you stated in the question that the Prophet permitted the wives to put a condition in the marriage contract that their husbands should not beat them. Indeed, we have not come across a Hadeeth with this meaning neither in Sunan Abu Daawood nor in any other books of Sunnah.
For more benefit on beating one’s wife and the conditions of doing so, please refer to Fataawa 89480, 84120 and 89180.
Allaah Knows best.