Bernardo asks 'Who's there?' and Francisco answers with the same question. This is significant because of the presence of the ghost. The ghost wears armour and a helmet, but it is not until Scene 5 that he shocks the characters and the audience by explaining that he has been killed by Claudius and want his son to take revenge.
At the start, the guards have been guarding the castle against invaders and 'Who goes there?' would be the normal challenge to anyone nearing the castle gate.
Barnardo opens the play by saying "Who's there?" That's whyShakespeare's audiences, especially the "groundlings" standing in the pit,were typically noisy and restless. "Nay, stand and unfold yourself" is Francisco's answer