A horse pacing back and forth can mean several things, depending on the context:
Stress or anxiety: Impatience, boredom, fear, nervousness, or pain.
Other reasons: Habit, social communication with other horses, or learned behavior from training.
What to do: Observe other signs such as tail swishing, pinned ears, or tense muscles. Consider environmental triggers. If the pacing is persistent, severe, or you suspect pain, consult a veterinarian or experienced horse handler.
The meaning depends on the individual horse, the situation, and accompanying body language.