The very first interaction of Barnardo and Francisco helps to begin to establish an ominous tone. Barnardo, a sentinel, is coming to relieve Francisco, another sentinel, and therefore he should be expecting to see him; however, Barnardo startles and asks, "Who's there?" as he approaches (1.1.1). To this, Francisco, the guard currently on duty, replies, "Nay, answer me. Stand and unfold yourself" (1.1.2). They are both clearly so on edge that, even though one knows that his relief is coming and the other knows he is going to relieve someone, they speak as though they are expecting a threat or an attack. This begins to establish the ominous mood.
Secondly, we learn that Barnardo and Marcellus have observed the appearance of a ghost or "apparition" twice recently, and so Marcellus brings Horatio with him to get his opinion should the ghost appear again. The appearance of a ghost on the castle ramparts also clearly helps to establish a dark and portentous mood.
Thirdly, when the ghost reappears, they identify it as the ghost of old King Hamlet, and he is wearing the armor that he wore when he last went into battle. Horatio says that, to him, "this bodes some strange eruption to our state" (1.1.80). We've already learned that the characters in this scene think highly of Horatio and his intelligence, so his saying this (combined with the fact that the ghost appears to be ready for war) seems to foreshadow that something tragic or violent is about to occur.