When you cut into land, such as a hill on your property, for instance, to make space for a landscape installation of some sort, a retaining wall can be placed at the bottom of the hill or cut earth to prevent the soil from crumbling, which may weaken the surface of the lawn. Retaining walls can also be used to hold soil added to create extra garden beds, such as in the case of a raised flowerbed.
Shorter retaining walls, no higher than 2 to 3 feet, can often stand without mortar, which is especially true in the case of raised flower or garden beds, which don't put much pressure on the stones or blocks used to build the wall and can be re-situated each year before planting to ensure that the wall is secure. Heavier blocks stay in place more effectively than lighter blocks.
Mortar won't be necessary in a retaining wall if, instead of blocks or stone, you build the wall from railway sleepers or another treated wood material. Railways sleepers are heavy enough to stay in place without any type of hardwood when used in short retaining walls but can be secured with bolts to build retaining walls. Standard treated wood can be secured with either screws or nails.
Some manufacturers make retaining walls blocks that have built-in connectors that keep the blocks in place without need for mortar. These blocks stack on top of each other like standard stone blocks but are held in place by the pressure of the soil behind the blocks.