You can either use pathing blockers (blocks other units as well.)
Or teleport the unit back into the region - if he leaves it.
You can also set it's movespeed to 0, to prevent it from moving at all.
Why would you want to trap a unit like that anyway?
I think he's trying to make a spell like prophet's in dota. i.e. you get trapped inside a bunch of units/destructables for x seconds, like a makeshift disable