Yeah, but I don't sign contracts when I get hired.
If I signed a five year deal with Miller, quit in the middle of my contract, and Miller doesn't want me to go work for Budwiser for the rest of my contract, they are allowed to do that. If Miller and I, agree to a buyout, they cannot exercise a restraint of trade.
In this case, allowing baseball players to quit in the middle of their contracts hurts MLB as a whole, and couldn't possibly be ruled illegal.