It is not uncommon.
I doubt it would be illegal in any state, although there are reasonable limits to what would be enforceable.
A common tactic that people use to try and get out of these is to claim that they were under duress. This may be applicable if you already quit your old job and were not formally advised (in writing) of the need to sign a training contract when you were offered the job. If you couldn't get your old job back, effectively you had no choice but to sign the contract.
Talk to a labor lawyer in the state in question.