Horses first lived in the wild where their flight-or-fight instinct became very strong. As a result, sleeping standing up enabled the horse to flee quickly when danger was sensed. Lying down to sleep significantly reduced the horse's ability to run away fast.
Do horses ever lie down and sleep? Yes! Many horses prefer to sleep lying down than standing up simply because it is much more comfortable. It is not uncommon to see a herd of horses, many of them lying down, but with at least one standing up. The standing horse is keeping watch over the others, keeping eye on any potential predators or other signs of danger.
When a horse is sleeping while standing they are not in a deep sleep, but are in a lighter sleep or snoozing. However, like humans, horses do need to have REM (Rapid Eye Movement) sleep that occurs during deep sleep. Also like humans, horses engage in slow-wave sleep (also known as SWS). To do this, the horse must lie down, not just with its legs tucked under its body, but fully lying down on its side. Sometimes you might see a horse asleep on its side with its legs moving. It is most likely that you are watching a horse dream.