I tried a few approaches. Ultimately the one that looked most natural while not being exploitable was this:
I set up a 'No Exit' Region to mark the boundary, and a 'Return To' region just north of it.
When a unit belonging to the player who is not allowed to leave enters the forbidden region, they are added to a 'no exiting' unit group. The unit is instantly moved north by 25 and then ordered to move north even further.
When it reaches the Return To region is gets a stop order
The instant movement amount is small enough that if the unit is immediately given an order to turn around and keep moving, it doesn't look like a teleport. It looks like the unit just turned around.
However, I found that if a determined player gathered a giant mass of units, crowded them all in together, and ordered them to move out a thousand times, sometimes one unit would indeed slip out.
So I created a second 'no exit' region just south of the first one, doing basically the same thing. Now it is sealed tight and it is impossible to squeeze in enough units to get anyone to slip out all the way.