Tough to stop someone from packing up their belongings and getting on a boat.
NASA has at times been used as a way to keep people with relevant skillsets employed domestically to prevent this.
Then they should pay them, in Germany a non-compete has to be compensated. A country might not want brain drain at all, is it then acceptable to stop people from leaving?