South Africa has an agreement with Lesotho and Swaziland for single point of management of the upper airspace of the three countries. Lesotho and Swaziland retain control over lower airspace. For example, Swaziland has a rule that nothing may fly over 50 ft over the ground without permission. A detective was once arrested and fined for flying a drone and taking pictures above that altitude. Swaziland also has a law that bans witches broomsticks from flying above 150 meters above the ground. No, it's not a joke.
Because of that agreement, it would be highly unlikely that South Africa would close airspace in such a way as to deny entry and exit to aircraft flying to and from Lesotho and Swaziland. I believe that the agreement might even require all three governments to agree before closing of the airspace, and in case of lack of agreement there would have to be corridors in place for aircraft to navigate to/from Lesotho and Swaziland.
That said, enforcement of the agreements may be another story. Paper and reality often diverge. Given the overwhelming disparity in economic, military and regulatory resources, I am not sure Lesotho and Swaziland would be able to enforce continued access if South Africa were to close its airspace for whatever reason.