In Hamlet, why did the dramatist bring the Ghost in front of Horatio?
Shakespeare evidently wanted a major character to see the Ghost and report it to Hamlet. (As much as possible, Shakespeare would have preferred to keep the guards in ignorance and out of the picture because of the need for extreme secrecy. Claudius must not get any hint that a ghost resembling Hamlet's father has been talking to Hamlet!!!)
This interview in Act 1, Scene 2 allows the poet to introduce Horatio and dramatize the growing friendship between these two men. Horatio will be Hamlet's confidant throughout the play, the only person Hamlet can really trust. Horatio's presence in the play enables Shakespeare to have Hamlet communicate some of his thoughts and plans aloud--to Horatio and to the audience--without resorting to any more soliloquies. The play is already heavily laden with these soliloquies because Hamlet is solitary, a deep thinker, and can't confide in anybody else. But soliloquies have an artificial quality. People don't normally talk to themselves. Shakespeare needed Horatio.
Shakespeare had to show the Ghost before the meeting with Hamlet, in order to establish that it was indeed a ghost and that it strongly resembled Hamlet’s father. But Shakespeare wanted the Ghost’s revelations to his son in Act 1, Scene 5 to come as a complete surprise to his audience as well as to young Hamlet himself. That was why he brought in the red herring of the troubles with young Fortinbras and the prospect of war with Norway, and why he had the Ghost appear in full armor.
The full armor is clearly intended for deception--to make the audience believe the Ghost is concerned about military matters. The audience is misled to believe that the Ghost’s appearance has something to do with politics and war. (Note that it was Hamlet, Senior who won a duel with the elder Fortinbras and with it some land which young Fortinbras is now seeking to reclaim.) Once Shakespeare had introduced the conflict between Norway and Denmark, he must have decided to develop that subplot further, as he does throughout the play.
But the Ghost cares nothing about political or military matters. Why should he? He’s dead! As Macbeth says of another king:
Duncan is in his grave.
After life’s fitful fever he sleeps well.
Treason has done his worst; nor steel, nor poison,
Malice domestic, foreign levy, nothing
Can touch him further.
So the audience, like young Hamlet himself, is shocked in Act 1, Scene 5 because they are totally unprepared for what they hear about Claudius’ villainy, having been intentionally misled about the purpose of the Ghost’s visitations. Suddenly, without warning, the audience is informed that Claudius murdered his brother in a fiendish manner in order to gain the throne and his brother’s wife. They should experience the same kind of shock that Hamlet himself experiences when he hears this news.
Horatio helps to mislead the audience about the purpose of the Ghost's visitations because he provides a distraction by answering at great length when Marcellus asks:
Good now, sit down, and tell me, he that knows,
Why this same strict and most observant watch
So nightly toils the subject of the land,
And why such daily cast of brazen cannon,
And foreign mart for implements of war,
Why such impress of shipwrights, whose sore task
Does not divide the Sundays from the week--
What might be toward that this sweaty haste
Doth make the night joint-laborer with the day?
That's an interesting question. It doesn't ask why the guards wanted Horatio to see the Ghost. Being a scholar they thought he would be able to question and assess the apparition. The reason Shakespeare wrote it that way one can only surmise. The reason I think he did are at least two. First, Horatio is the chronicle of the play. In the end he presents himself to Prince Fortinbras as the witness to the events in Elsinore. He sets himself up as both the story-teller and the playwright. At the close of the play Horatio declares,"let me speak to th'yet unknowing world..." and "...let this same be presently perform'd." At the start of the play he arrives early. Oddly enough he does not accompany Hamlet on his journey for England, but stays behind to observe the fallout of Polonius' death.
Second, as the play opens Barnardo begins to tell the story of the Ghost but he is interrupted by the Ghost itself. Horatio then takes over and furthers the ghost story. Again the subject of the story in dramatic fashion interrupts the story-teller and establishes once and for all that the actors are "the abstract and brief chronicles of the time." Legend has it that Shakespeare himself played the Ghost, which it seems would be particularly fitting. Other than briefly recounting the Ghost's visitation to Hamlet, Horatio's role becomes that of observer. As part of the audience he witnesses the "reality" of events as they unfold before him. The appearance of the Ghost takes the story away from Horatio and delivers us to the drama of Hamlet.