After being instructed to keep Ophelia under his watchful eye, Horatio wishes Ophelia could be as safe as the queen wanted her to be, as this would surely mean she couldn't get hurt.
Unbeknownst to Horatio, the Queen had always secretly disapproved of Ophelia's relationship with Hamlet, and had wished her dead many times. After Horatio makes his wish, an unknown figure who may or may not be the queen drowns Ophelia, and returns to the castle to tell the story of her death.
Upon finding out Hamlet has been sent to England, Horatio uses his third and final wish, asking that Hamlet would return safely home for good. He then receives letters from Hamlet saying he is returning.