Probably through penalties listed in the contract, or simply suing for breach of contract.
While many US states allow at-will agreements that allow either party to depart at any time for any reason without penalty, as far as I know, you're not required to be employed at-will if both parties agree to the terms of the contract.
While it's a somewhat special case, I know the US federal government often employs people with though-shalt-not-break-without-penalty contracts. Examples are military service, and many of the higher-education loan-forgiveness programmes.
The two year commitment is based on a verbal agreement between you and the employer if you are invited to interview. We just want someone that will stay with us for a good length of time.
How will this be enforced?
Computer skills
One would hope a programmer does...
provide a transcript and two letters of recommendation if they are invited to interview
You're serious? This is a real job post? To HN?