The problem isn't leaving, the problem is finding a country to accept you. You can have a passport but if you don't have the visa, they'll turn you away at the airport.
Let's not also think that back in the day of the USSR it was easy to travel around the world. Schengen and the popularisation of air travel are relatively recent developments.
The big measure I can think of was in the GDR, but even then the "Berlin wall" was maligned. Imperialists created a problem and then mocked the only solution. They actually created two problems; the first one was dividing Berlin in two. https://en.prolewiki.org/wiki/Anti-Fascist_Protection_Rampart