Keep in mind that foreshadowing means the warning or indication of a future event in the story. This quote in context is from chapter 14, and speaks of Ender's increasing difficulty in "training" at Command School. At the end of the story, the reader discovers that the battles on the Simulator were not "training" battles, but the actual war with the Buggers, and Ender, of course, leads Earth to a victory.
This quote doesn't foreshadow a future event, but rather foreshadows future information that more fully explains current events. It turns out, Ender's key to success is his ability to empathize with the Buggers. Though the explanation isn't especially obvious at first, what we discover is that Ender and the Buggers are intimately connected through The Mind Game. There is a scene where the teachers admit they do not even understand what controls The Mind Game. It turns out, it is the Buggers. These dreams he has while at Command School are just as vivid and just as disturbing as The Mind Game from Battle School. It could be suggested that because Ender is living on their (now abandoned) home planet of Eros, the Buggers no longer need The Mind Game to make a connection with him.
They have access to Ender's mind and his memories, and therefore have a very powerful place in his training. It is an ironic connection, because ultimately it leads to their universal destruction. However, as the "Speaker for the Dead" we understand that Ender is able to rescue one last egg, a Bugger queen, and travels space purportedly to give the Buggers a second chance at existance. His worst memories here are those of Peter and any time in his life that he feels like a killer. The further irony in this statement is that he isreliving them (his worst memories) again, because in his "training" on the Simulator, he iskilling real Buggers (and some real humans flying real ships are also dying), but at this point in the story, he doesn't know that.