The main purpose of Horatio's speech is to inform the audience of the events leading up to this point.
In this excerpt, Horatio is telling the audience what has happened in the past. He refers to the battle that King Hamlet fought against Fortinbras, the King of Norway and also Hamlet's biggest rival. Moreover, Horatio describes King Hamlet as a courageous man for killing Fortinbras in that fight and gaining his territories. He informs the audience about these events because later on the story King Fortinbras' son will seek to recover the territories that were lost.