Hello. You did not inform the story that this question is referring to which may leave the answer a little inaccurate, but I will try to help you in the best possible way.
Foreshadowing is a literary device that allows the author of a text to expose clues about what will happen later, within the plot of the text. This feature serves to impose anxiety, surprise and learning on the reader, being very effective when used correctly. An author can use Foreshadowig to reinforce a concept within the text, thus highlighting the main theme or meaning that the text wishes to convey.