My feeling is that Horatio and Hamlet are not so close at the top of this play. There’s a distance between them at the beginning that vanishes right here. Or rather has vanished at some point prior to this scene.
Something has passed between them that has assured Hamlet that he could share this deepest secret of his father’s ghost with Horatio. He’s told him of the circumstances of his father’s death and he trusts him rather deeply.
I almost wish that Shakespeare had written us these conversations. I’d love to see a friendship bloom. We see them dissolve so often. I’d like to see one grow. And I’d love to see what Horatio said (or didn’t say) to so clearly earn Hamlet’s trust.