You can find the answer to this in Act II, Scene 2. It is found in the passages where Voltemand is reporting to King Claudius the results of his visit to Norway.
He says that the King of Norway was upset to hear of Fortinbras's plans. When he confirmed that Fortinbras was trying this, he arrested him and made him swear that he would never attack Denmark.
Instead of attacking Denmark, Fortinbras agrees to take the soldiers he has gathered and use them to go attack Poland. The King of Norway asks Claudius to let Fortinbras and his troops pass through Denmark on their way to Poland.
In Act I, Scene 2, King Claudius addresses his courtiers as he explains his marriage to Queen Gertrude and other matters of state. One of these matters of state is the letter from Prince Fortinbras, who demands the return to Norway of the lands stolen from his father by King Hamlet. Claudius states that in response, he has sent a message about this situation to the elderly uncle of young Fortinbras, who now sits on the throne of Norway.
Then, in Act II, Scene 2, the courtiers Voltemand and Cornelius return from Norway where they have negotiated with the elderly king. This king informs the Danes that after having become aware of the plans of his nephew, Prince Fortinbras, to attack Denmark instead of Poland as he has thought, he has taken measures to prevent Denmark's invasion.
Angered that Fortinbras intends to take his troops to Denmark, the old king has ordered his nephew to abort these plans. Further, Prince Fortinbras is made to take a vow before his uncle to never "...give the assay of arms" (2.2.71) against Denmark. Now, Fortinbras will direct his army to Poland, the king of Norway informs Voltemand and Cornelius.
Prince Fortinbras is a foil to Hamlet because he decisively takes action to win back the territories that his father, King Fortinbras, lost to Denmark's King Hamlet. On the other hand, Prince Hamlet spends hours wallowing in personal conflict and agonized thought rather than actually taking steps to avenge his father.
In order to reach Poland, Prince Fortinbras later requests permission for passage through Denmark (Act IV, Scene 4). It is when the Hamlet witnesses Prince Fortinbras enter with his army, that Hamlet observes the brave prince
Exposing what is mortal and unsure
To all that fortune, death, and danger dare,
Even for an eggshell....(4.4.51-53)
Witnessing the courage of Fortinbras, Hamlet is ashamed of himself and is finally inspired enough to take action to avenge his own father's death. At last, he lets his "thoughts be bloody, or be nothing worth!" (4.4.64-66), and he takes action.