The Berlin Wall was built to separate East and West Germany. After World War II, Germany was partitioned into two: the USSR-allied East Germany, and the US-allied West Germany. The wall was built to stop East Germans from escaping to West Germany. This page was last updated on September 20, 2017.
https://www.worldatlas.com/articles/why-was-the-berlin-wall-built.html