Garden walls have lots of uses, such as:
Holding earth back so you can create a terraced area, or stop a steeply sloping bank from collapsing.
Creating a solid barrier next to a road or footpath to reduce noise, or for privacy.
To divide a garden into different areas, or provide extra seating around a feature like a terrace or pond.
To provide a low, solid base on which you can put up fencing, or build piers to support an overhead structure such as a pergola.