A sailor gives Horatio letters from Hamlet. The letter says that a pirate attacked Hamlet's ship. Hamlet was taken prisoner and returned to Denmark for a ransom, while Rosencrantz and Guildenstern continue on to England. Horatio is to send the sailors to Claudius, and then to find Hamlet.
The pirate attack is an example of deus ex machina—a device used to further the plot and return Hamlet to Denmark. It doesn't have any real thematic meaning.