This is somewhat of a myth. Horses can get a lot of sleep while standing up, but they lie down when they require REM sleep. Typically, the amount of REM sleep they require is very small, so they don't need to lie down often. However, many horses lie down just because they feel comfortable or want to do so.
The reason horses can sleep while standing for most of their sleep cycle is because it allows them to quickly escape an attack by a predator without having to waste time standing up (which can be a slow process compared to a predator attack). The method by which horses stand while sleeping is called the "stay apparatus," and it's a system of ligaments and tendons that keep them upright with relative ease.
Horses also like using the buddy system for sleeping, where one horse watches over the others while they're sleeping. The role of watch-horse will rotate as each member of the herd gets the sleep they need, including lying down for necessary REM sleep. Many horses adopt this kind of rotation when they're in their home barn setting, either in a paddock or in a stall next to their regular neighbors.
When I used to show, I often had to stall my mare overnight in someplace unusual. I knew the travel and new sleeping environments would be rough on her sleeping schedule, and I could often gauge my performance on how well she slept. There was a pretty good correlation between her performance and whether or not I had to brush stall shavings off her belly. If she had shavings on her belly, I knew she had a good night's sleep. If not, then I figured she hadn't slept well and might have problems.