He didn't order it, it was erected by the East German Government
(known as the German Democratic Republic, or GDR) in 1961 to
prevent mass defections and migrations from East Berlin to the
West.
It had the approval of the USSR, but Moscow didn't actively
order it's construction- at least, not as far as we know (Kruschev
may have secretly put pressure on the East German Government to
build it).
The reason given by the East Germans was that it was to protect
'fascist elements' from undermining the Communist state, but this
was at best only partly true- the East German Government may well,
indeed, have been worried about Western spies and infiltrators
crossing over and whipping up an anti-Communist uprising such as
happened in Hungary in 1956, but it was also meant to keep
potential defectors IN and stop them from getting across to West
Berlin.
The wall cut off West Berlin from it's Eastern half and also
from surrounding East Germany- it actually consisted of two parts,
a Western and an Eastern wall with a corridor of land about 100ft
wide between them. This became known as the 'Death Strip' in the
West and contained trenches, anti-vehicle traps, and watchtowers at
various intervals, with the guards ordered to shoot on sight
anybody seen in the strip unless they had official permission to be
there.
It also contained a few ruined buildings that were damaged by
Allied bombing in WW2 and had never been restored. The wall
remained standing until Germany was officially reunified in 1990,
when wholescale demolition work of it began. This wasn't completed
until two years later, although several sections of the wall remain
standing as historic monuments, including three quite long
stretches of several hundred feet. Some of the watchtowers and
checkpoint buildings also remain, and have been turned into museums
or converted to peaceful use.