The flip side of this is the company can fire or lay you off at anytime. So while 2 weeks notice may not seem like a lot, the system we have here is actually potentially much harsher for employees than employers.
As with the 2 week notice courtesy from employees to employers, most places will offer some sort of severance pay to soften the blow, entice employees to sign an NDA and smooth over any legal challenges that might pop up despite the "at will" employment situation.
You have to give a month's notice because your employer can't arbitrarily show up at your desk, say pack up your stuff and get out of the building within the hour (with security hovering around you and your computer locked down) and this is the last day we're paying you for.
Reading about zero or two weeks notice here makes me thinking what that does for the job market. On the one hand it surely makes for more movement, on the other hand it must make for a more ruthless job market. One of the upsides that I perceive with the three months notice is that it makes you think long and well about quitting, and encourages you to work things out. You don't just rage quit, because you'll have some three uncomfortable months.
If however, things really don't work out and both parts acknowledges this, you often come to an agreement of parting earlier.
This enforced by law, so if you don't pay, they would just throw you in court.