Shakespeare had a big problem with introducing the Ghost. He had to establish for the audience that an actor was a ghost. This was not a problem in Macbeth, for instance, because the audience had seen Banquo killed and knew that he was dead. Then when Banquo showed up at the coronation banquet the audience knew that he had to be a ghost. But the audience has not seen King Hamlet before. They only know by report that he is dead. Shakespeare uses most of the opening scene of Hamlet to establish that the actor playing the ghost is actually a ghost and not someone who just looks like the dead King Hamlet or King Hamlet himself, who did not really get killed by a poisonous snake but has somehow recovered. Shakespeare could not dress the actor in a ghostlike shroud because that might make the actor look like a ghost but would not help to establish that he was the ghost of King Hamlet. So the playwright conceived the idea of having the actor wear armor in order to make him at least look "different" whenever he appeared. And the guards swear that it is King Hamlet's old armor. The actor would have been directed to act in a "ghostlike" manner--that is, to stride slowly, looking straight ahead, ignoring the guards watching him. He would have been wearing wool stockings or felt slippers so that his steps would be silent, whereas the others would make the usual stomping on the boards when they walked. The Ghost would seem to be floating. It is the dialogue that does most to establish that this actor is the ghost of King Hamlet. The guards all swear that the actor looks exactly like the dead king. And Horatio, who is extremely skeptical at first, finally acknowledges that it must be the ghost of King Hamlet.
How now, Horatio? You tremble and look pale.
Is not this something more than fantasy?
What think you on't?
Before my God, I might not this believe
Without the sensible and true avouch
Of mine own eyes.
Shakespeare wanted to establish that the actor was the ghost of King Hamlet before the Ghost ever encountered his son. If the Ghost suddenly appeared to Hamlet without a prior introduction, it would necessitate a lot of explanation and questioning, all of which is avoided in Act I, Scenes 4 and 5. Most of the dialogue in Scene 1 is intended to establish that the actor playing the Ghost really is a ghost and looks exactly like the dead king.
But why the armor? For one thing, it makes the actor look "different" without resorting to shrouds and that sort of thing. But there is another more important reason. Shakespeare does not want anyone--including anyone in the audience--to suspect that the Ghost is there to talk to his son in confidence (which is really what most oof the first act is all about). The armor is intentionally misleading. It makes the guards and the audience believe that the Ghost is there because he is taking an interest in the possible war with Norway. When the Ghost tells Hamlet in Scene 5 that he was murdered by Claudius, it will come as a complete surprise. But Shakespeare had to add some dialogue about Fortinbras and the war preparations to make the Ghost's arrival seem plausibly connected with that crisis. The threat of war is a tempest in a teapot, a red herring. The whole business is wrapped up in the next act. The Norwegian king tells Fortinbras to cease and desist, and the crisis is over. Which proves that it was only intended to mislead the guards and the audience.
Although three witnesses--Marcellus, Bernardo, and Horatio--have seen the Ghost, they do not suspect that he was there to talk to his son Hamlet. Shakespeare attaches supreme importance to keeping the Ghost's purpose and information a complete secret between the Ghost and his son Hamlet. Hamlet gets the others to swear to keep the Ghost's appearance a strict secret. If Claudius heard anything about a ghost visiting the castle, his guilty knowledge and guilty conscience would immediately lead him to suspect that the ghost had come to tell Hamlet the truth about what happened in the garden when King Hamlet was supposedly bitten by a poisonous snake.
Now, Hamlet, hear.
'tis given out that, sleeping in mine orchard,
A serpent stung me. So the whole ear of Denmark
Is by a forged process of my death
Rankly abused. But know, thou noble youth,
The serpent that did sting thy father's life
Now wears his crown.
Hamlet begins with two guards and Horatio discussing recent events in Denmark, the most notable being the ongoing conflict with Fortinbras of Norway. Horatio explains the backstory to the guards in Act I, Scene i, lines 79–107. The main points of Horatio’s speech explains that Hamlet Senior, the titular Hamlet’s dad, was challenged to combat by Fortinbras of Norway and won. Because Hamlet Senior beat Fortinbras, according to Fortinbras and Hamlet Senior’s agreement, Fortinbras’s land goes to Hamlet Senior. Now Fortinbras’s son, young Fortinbras, wants to avenge his father and get back his family’s land. Horatio notes that no one really knows yet how good at fighting Fortinbras Junior is, but he’s gotten together a gang of men in Norway and is now stirring up trouble. This backstory, as Horatio notes at the very end of this speech, explains why Marcellus, Barnardo, and Horatio are even keeping watch in the first place. An outside force is threatening Denmark and the warlike king, Hamlet Senior, is no longer there to protect the kingdom. People are nervous. Additionally the threat of upsetting the current kingdom comes from a son, upset by his father’s death and the loss of his birthright, a theme we see again throughout the play with Hamlet and Laertes.
The ghost’s appearance supports this because he is dressed for battle. Horatio tells Hamlet in Act I, Scene ii, line 200, the ghost is “Armed at point.” This must be important because they return to this detail later, in this exchange from lines 226–230:
Hamlet Armed you say?
All Armed, my lord.
Hamlet From top to toe?
All My lord, from head to foot.
Hamlet Then saw you not his face.
Horatio O, yes, my lord. He wore his beaver up.
Hamlet Senior appears not just as a ghost, but as a ghost prepared for battle, wearing armor from head to foot and with his visor up. His warlike outfit suggests that he is anticipating a conflict and has come to wage war, both against Fortinbras Junior and against Claudius.
This is the point that Horatio raises in his allusion to Julius Caesar in Act I, Scene i, lines 112–125. He reminds Marcellus and Barnardo that right before Julius’s reign was violently ended there were strange, supernatural occurrences, like empty graves, the dead reappearing in the streets, shooting stars, dews of blood, disorder in the movements of the sun and moon. He notes that these weird occurrences seemed to predict that something bad was about to happen, and says that Hamlet Senior’s armored appearance is “prologue to the omen coming on.”