This line is from Act IV, Scene 5 in which poor mad Ophelia has lost both father and lover. Bereft without either, the girl tragically comes apart and commits suicide. In the previous scene, having observed Fortinbras, "whose spirit, with divine ambition puffed," decide to risk fortune and death in order to avenge his father, Hamlet is thus inspired to finally avenge King Hamlet's death. Clearly, then, he and Ophelia have both realized the import of her words. However, Fortinbras yet has to learn what he "may be." In the final act, after Hamlet has been pierced by the poison tip of the sword of Laertes, he hears the return of Fortinbras heralded and leaves his kingdom to the "gentle prince" of Norway.
After being thus informed, Fortinbras says,
...with sorrow I embrace my fortune.
I have some rights of memory in this kingdom,
Which now, to claim my vantage doth invite me. (5.2.404-406
Having been "invited" to rule as the head of the kingdom of Denmark, Fortinbras, therefore, faces the challenge of what he "may be" in this new position. He has only begun as leader of Norway and accomplished avenger of his father's death, and he has not yet proven himself a judicious ruler in either country despite Hamlet's faith in his integrity.