A contract in perpetuity is considered legal and valid if it does not infringe on the law. The only time a contract in perpetuity would be considered illegal or invalid is when it occurs between two parties that do not have the right capacity to enter into such an agreement.