1,668. A Condition Not to Inherit
Hilchos Ishus 23:5
If a man makes a condition not to inherit his wife’s property, the condition is binding but he may still receive the proceeds that the property generates in her lifetime. The same is true if his condition is that he will only inherit some of her property or that her property will return to her father’s family if she dies without having children.
Hilchos Ishus 23:6
The above only applies when the man made his condition before the marriage was finalized. This is because a person can only waive an inheritance coming to him from outside his family before he obtains the rights to it. If, however, he made the condition after the marriage was completed, then it is ineffective and he inherits his wife as was explained in halacha 12:9.