The fact that you are on an H1B does not affect the validity of a contract one way or another. The contract you describe, while onerous, appears to be legal: an employee can contract to stay with an employer for a given period of time, and can further agree to pay some amount to the employer if the employee leaves employment early. It is also legal to agree to the law (e.g. state law) which will govern a contract to waive a jury trial in the event of an alleged breach or dispute over the contract. Your personal situation--whether or not you will have the money to bring your family to the U.S. has no bearing whatsoever on the contract's validity or enforceabiity: people cannot escape contracts because they are bad for them. Based on what you write, this contract is enforceable.