In act 1, scene 4, when Hamlet shrugs off the dangers of going off by himself with the ghost, Horatio expresses his concerns. These center around the possibility of the ghost using his supernatural powers to deceive Hamlet into destructive acts that could kill him.
First, Horatio worries that the ghost might find a way to "tempt" Hamlet into jumping into the sea and drowning. Second, he expresses concern that the ghost might lure Hamlet to the edge of the cliff high over the sea. In that treacherous place, the ghost might frighten him to madness by taking on a terrifying form. This could so terrify Hamlet that he would lose all reason and go crazy. The implication is that Hamlet would jump off the edge of the cliff, thus killing himself.
Horatio warns Hamlet to be careful of the dangers of dealing with the supernatural. Hamlet may be so depressed that he says he doesn't care what happens to him, but the level-headed Horatio guesses that Hamlet might not be as willing to throw away his life as he thinks he is.
Horatio's words suggest that the castle is close to the sea, high up on a cliff, a geography that presents dangers. He has the best interests of his friend in mind in counseling him to be cautious. His words also build up audience suspense about what might happen next.