The barrier section of the Wall that blocked off West and East Berlin was 27 miles (43 kilometres) long. Before the Wall's erection, 3.5 million East Germans circumvented Eastern Bloc emigration restrictions and defected from the German Democratic Republic (GDR, East Germany). At that point in time, many people could just cross over the border from East Berlin into West Berlin.

So, the Berlin Wall was created as a barrier; and, it divided Berlin from 1961 to 1989. Constructed by the German Democratic Republic (GDR) in August 1961, the Wall completely cut off (by land) West Berlin from surrounding East Germany.

Because of political changes, the East German government announced in November 1989 that all GDR citizens could visit West Germany and West Berlin. Crowds of East Germans crossed and climbed onto the Wall, joined by West Germans on the other side in a celebratory atmosphere.

Demolition of the Berlin Wall officially began on June 13, 1990 and was completed in 1992.

More Info: en.wikipedia.org