There were specific routes, corridors, for traveling by car, plane and train. You would cross into East Germany and be checked at the border between the two German staates again.
Some people in East Berlin were officially permitted to travel to the West, often travelling on a daily basis for work. This gave them the financial benefits of Western wages and the economic benefits of Eastern living (artificially low prices, especially in rents).