First of all having such a condition in the contract isnt permissible by all. Theres two opinions : 1- That its not a valid condition to begin with. The evidence for this view is a hadeeth that basically says any condition that is not in the book of Allah or in the Sunnah is invalid. Theres other hadeeths about conditions that make halal haram or haram halal, invalid. They have other things to support this view but since you're just asking i'll cut it short to just give a broad general idea. Those who hold this view are mostly Hanafis, Malikis, and Shafi'is. It is attributed (I dont know if the attiribution is valid or not) also to Ali raa, Ibn Abbas, and some Tabi'ees such as Saeed Ibn Al Musayyib and Al Hasan Al Basri and others. 2- That its a perfectly valid condition as long as they both agreed to it. In this case the husband is "forced" to fulfill the condition, if he doesnt then she may get a divorce (as opposed to going through the process of Khul', getting it from a judge) and retains all of her rights. This opinion is held mostly among scholars of the Hanbali Madhab. It is also the position of Umar Ibn Al Khattab raa, Abdallah Ibn Mas'ood raa, Sa'd Bin Abi Waqqas raa, Muawiya Bin Abi Sufyan raa, and Amr Ibn Al Aas raa. Many also from the Tabi'een hold this few such as Al Awza'ee, Al zohree, Saeed Ibn Al Jubair and others. This is also the opinion of the prominent Hanbali scholar, Ibn Qudama in Al Mughnee. They also have "evidence" supporting this, but too long to list. ( The information above is a translated summary from Arabic material.) So my understanding of this is that she doesnt have to get a divorce, but may if she wants, and may nullify the marriage (Faskh, a term used usually when talking about contracts). Hope that helped.