The frequently unspoken tenet of all modern governments and organizations, is that you are generally not free to leave (pandemic aside).
Every place as it's first defensive measures tends to the resort to the same idea: prevent people from leaving (so, take them prisoner). Because if people were truly free to leave, then good luck exploiting them.