Well, the most obvious example of foreshadowing in this excellent dystopian novel is the very beginning, where David dreams of the city of Sealand that he finally reaches at the end of the novel. Note how it is described:
When I was quite small I would sometimes dream of a city - which was strange because it began before I even knew what a city was. But this city, clustered on the curve of a big blue bay, would come into my mind. I could see the streets, and the buildings that lined them, the waterfront, even boats in the harbour; yet waking, I had never seen the sea, or a boat...
Flicking to the end of the novel and the last section of the last chapter, David sees this sight in reality, rather than in his dreams. Note that he says:
It was just as I had seen it in my dreams... It was so familiar I almost misgave.
Wyndham therefore effectively foreshadows the happy ending and the safe arrival of David in Sealand by introducing this dream that becomes real at the end of the novel.
There are plenty of other examples that you can look at, especially the way that Sophie is used to show the fate of deviants and also the dream that David has of his father just about to sacrifice Sophie as if she were a mutant calf.
As the previous post said, the best example of foreshadowing is the very first paragraph of the novel. David is the narrator of the story, and he tells readers about a dream that he used to have when he was a young boy. The dream is about a beautiful city by the sea. David tells readers that the dream is especially odd because he had the dream even before he knew what a city was. The dream foreshadows David's eventual escape from the Waknuk society to the city where the Sealand woman takes him.
Another good example of foreshadowing is from another dream that David has. This time, David dreams about his father slaughtering Sophie. David is familiar with his father killing any Deviant animals that they have on their farm, so the idea of Joseph killing creatures with too much genetic variation is not foreign to David. Sophie is a Deviant because she has six toes. David dreams that his father knows this and slaughters her in front of people in the same way that he does it to farm animals.
My father held Sophie with one arm just as he had held the struggling calf. He raised his other hand high, and as he swept it down the knife flashed in the light of the rising sun, just as it had flashed when he cut the calf's throat....
The dream foreshadows that Joseph will eventually learn about Sophie's condition. That's exactly what happens at the end of chapter five. Joseph learns the specifics about Sophie because he beats David with a whip in order to force the information out of David.
"Now he says this child you were with has six toes. Is that true?"
"No," I told him.
"He's lying," said my father. . . "I'll deal with this. The boy's lying." To me he added: "Go to your room."
I hesitated. I knew well enough what that meant, but I knew, too, that with my father in his present mood it would happen whether I told or not. I set my jaw, and turned to go. My father followed, picking up a whip from the table as he came.