It�s unusual to find a training contract that insists you stay, but not unusual to find one that says you must repay the cost of the course if you go within an agreed period of time.
However, even if your employer has such a policy in place, if they did not draw it to your attention before you agreed to do the course (which usually takes the form of getting you to sign a copy to say your saw it) there is nothing they could legally do about it at this stage. Have a discreet look through your staff handbook or publicly available employment policies and see if there is anything about this in there. If not, resign and challenge them if they try it on.