The red coats come marching in to set a trap for the highwayman. They know that he will return for his love, Bess, the innkeeper’s daughter. So, the soldiers plan to use her to get to the highwayman.
The soldiers are very disrespectful and do not care who they hurt. They barge in and drink all the ale without even saying a word to the landlord. Then they tie up Bess and gag her so she can’t warn her boyfriend about the ambush. “Two of them knelt at her casement, with muskets at their side! / There was death at every window.” The soldiers know that they can see the road from her bedroom window, so when they see the highwayman coming, they can surprise him. He has promised Bess he will return: “I’ll come to thee by moonlight, though hell should bar the way!”
The red-coat soldiers also taunt Bess as they tie a musket under her breast. “ ‘Now, keep good watch!’ and they kissed her.” The soldiers probably plan to use Bess as bait: once the highwayman comes in to see her, they can force him to comply with them. They probably guess that once the highwayman sees the gun, he will want to save his love, so he will go with the soldiers.