What were some possible reasons for the ghost's appearance?
Which time? The ghost appears in the first Act to urge young Hamlet to seek revenge for his murder. No one other than Claudius, the murderer, knows for sure that King Hamlet has not died of natural causes during his nap in the garden, although there is the question of whether or not Gertrude was involved with the plan to get rid of the king.
Later on, the ghost reappears to Hamlet in Gertrude's bed chambers. Here, the ghost may be continuing to urge Hamlet to action where the revenge is concerned, or the ghost may appear simply to have Hamlet take a more gentle approach with Gertrude.
Barnardo and Marcellus persuade Hamlet to witness the ghost's next appearance. Once this has happened the officers all have different reason for the ghost's appearance. They suggest that the ghost appearing suggests a coming tragedy. They also link it to the coming war with Fortinbras.
Hamlet does not share in the theories of the fellow men. This is because Hamlet is the only one to actually hear the ghost speak. The ghost has appeared with a request that is only for Hamlet. It is the ghost of Hamlet's father, and he asks Hamlet to seek revenge for his murder.