They do it with teacher contracts. If a teacher wants to change districts, they can, but they have to fulfill their current contract or be subjected to their license being suspended for 1 school year. For example, if I was a teacher and found a new teaching position today, I can't put in my 2 weeks notice and leave before the school year is up. I'd assume coaching contracts are similar. For teachers, they have until July 10 to resign their position. After that date, they could face penalty for breaking their contract.
With coaching, I don't know what the cutoff would be. Supplamental coaching contracts are typically year to year and conclude at the end of the season. I guess it depends on when a board approves the coaches for the following year.