Dear Pramod, there are a few things to keep in mind in such situations.
Validity of the Contract
1. Any contract that violates your right to seek employment is void.
Validity of the Compensation Amount
2. There cannot be an ad hoc amount like 12 months' salary as compensation. There has to be a link between the cost incurred on training and the compensation. Also, consider factors like whether there was any actual training imparted or if it was on-the-job training, etc.
Effects of Resigning with or without Payment of Compensation
3. In case you resign without paying the compensation, understand that you will not be given your relieving letter. Also, the company could always mess up a reference check.
The question here is, even assuming that the contract is void, do you have the time, energy, and money to take the company on in a court of law?
There are a lot of cases of such incidents being posted on citehr. In view of this, my advice is firstly, do not sign such agreements. When prospective employees refuse to sign such contracts, the occurrence of such will reduce.
I know a lot of members will point out the lack of bargaining power. But understand one thing well; it is better to be refused employment in a firm with such practices than to be stuck there after joining. Understand that in most cases after you join, you have even less bargaining power.
Regards,
Savio