One of the legal maxims of Islamic jurisprudence is "rights decisively lean on provisions" This principle is derived from the sayings of the second caliph of Islam Umar Ibn Al-khatab when he said to one of his subjects to fulfil what his wife had stipulated.
This principle shows that any conditions stipulated by both partners in a contract is a valid condition that must be fulfilled, and it is not permissible to break it, unless there is proof to show that they it is not valid. The evidence for that is the general meaning of the evidence which speaks of fulfilling covenants:
“O you who believe! Fulfil (your) obligations” ( Q5:1)
“And fulfil (every) covenant. Verily, the covenant will be questioned about”(17:34)
Also, in the hadeeth narrated from the Messenger (blessings and peace of Allah be upon him) it says: “The Muslims are bound by their conditions, except a condition that forbids what is permissible or permits what is forbidden.” Narrated by al-Tirmidhi (1352). And he (blessings and peace of Allah be upon him) said: “Whoever stipulates a condition that is not in the Book of Allaah it is not valid, even if he stipulates a hundred times.” Narrated by al-Bukhaari and Muslim.
To sum up, the basic principle with regard to conditions is that they are permissible and valid, whether they are to do with marriage, buying and selling, renting, pledges or mortgages. The ruling on the conditions that are stipulated in contracts, if they are valid, is that they must be fulfilled, because of the general meaning of the evidences mentioned above.