Both Catholic and Protestant religions, the common religions at that time, the presence of ghosts. The Catholic religion even specifically preached that souls in purgatory would have to work off their sins until they could reach Heaven. This concept is in line with the ghost's actions throughout the play.
Elizabethan audiences would have been particularly ready to believe that supernatural occurrences would be more likely in the wake of deeds which challenged or upended the natural order of things, such as the murder of King Hamlet. The unnatural state of Elsinore is emphasised throughout the first act: "Something is rotten in the state of Denmark" (Act 1, Scene v).