It was made to keep invaders out.
Although it's not tall enough to actually keep people out.
It is designed to slow any attacking force. (Because the attacking force would have
a difficult time getting resources and horses over the wall)
It's also considered a very ambitious engineering quest...