Getting fired probably reflects poorly on you when they call your former boss, though..
It's something similar in Sweden, though the contract goes both ways. They can't give less notice for firing you than you can for quitting, so it just damps the system somewhat.
It's pretty cultural. The contract is a two way street. Most people don't do what you describe because they wouldn't want the company doing it to them. People probably also worry about burning bridges.
Since it's a legal contract violating (by leaving) it could lead to lawsuits.
How do you contract this sort of thing? If I wanted to quit and I had a contract like this, I would just stop coming to work, or I would come to work and do a bad job.