The two were discovered by a patrol shortly after 3am in a military building in Waldstatt, canton Appenzell Ausserrhoden.
When taken by surprise, they attacked the patrol with knives, injuring a 25-year-old soldier slightly in one hand before taking flight, local reports said.
It is believed that one of the two robbers was also injured in the skirmish, reports said.