The play opens with Bernardo taking over Francisco's watch at midnight. These are two Danish guards who are standing watch on the castle battlements at Elsinore, which overlooks a narrow waterway that separates Denmark from part of Norwegian-controlled Sweden (although at the time the play was written, Denmark and Norway were united as a single kingdom). Indeed, if Norwegian spies or an attack were to come, these sentries would be on guard to sound the alarm.
The play is set during a precarious time for the Kingdom of Denmark. Old King Hamlet has recently died. His brother, Claudius, has assumed the throne but the country has not fully settled after this transition. Fortinbras, the Prince of Norway, is still seething about the death of his father at the hands of the deceased Danish king. His army is poised to invade Denmark. It is signs of this potential invasion that Bernando and Fransisco are likely on watch for.
Bernardo and Francisco are guarding the palace of Elsinore, the residence of the King of Denmark. As Horatio explains later in act 1, King Hamlet of Denmark has recently died, and the nephew of the king of Norway, whom King Hamlet defeated years earlier, is planning an attack on Elsinore. The nephew's name is Fortinbras, and he thinks that Denmark will be weak because the old king is dead and his brother, Claudius, has taken his place. Since the country is still in mourning and a transition in power is taking place, Fortinbras believes he can strike at Elsinore and regain the territory his father lost to the old king.