This quote comes near the climax of the book, as Mazer Rackham is putting Ender through brutal simulations to test his resolve and his ability to function under pressure. Ender doesn't know that the "simulations" are real battles; this is deliberately kept secret so he won't feel the true pressure of his command, and so he will focus his anger on beating Rackham's simulations. When he begins to have nightmares, exhausting him, Rackham says:
"Strange dreams are a safety valve, Ender. I'm putting you under a little pressure for the first time in your life. Your body is finding ways to compensate, that's all."
(Card, Ender's Game, Google Books)
Rackham, knowing that Ender is in danger of collapsing under the pressure, is trying to reassure him that dreams are not real. This helps to hide the truth behind the "simulations" and is also real advice; Ender's mind, overtaxed by the battles, is mixing his past and present to help expel his tension. Rackham is not a cruel man, but he needs to be harsh to keep Ender on task; without Ender's military mind, the war is likely to be lost, and so this quote represents both Rackham's empathy for Ender and his pragmatic nature.