I remember India itself violating this as part of pandemic related restrictions last year, when they tried to restrict entry of Indians who were abroad back to India.
The problem with international law is of course that there is no way to enforce it, the states are sovereign. But a state can’t violate them too egregiously and still pretend to be a first world lawful state.