Did Switzerland expect to be attacked, or join the war in some way?
Switzerland mobilises whenever a war erupts between its neighbours (I'm talking about the modern Swiss Confederacy, established in 1848; earlier, when such a ware came about, they would more probably send people to war as mercenaries). Parliament elects a general, in this case Hans Herzog, who takes command of the army - in peacetime, the highest rank is a corps commandant.
The obvious reason for this is to avoid the Belgian treatment - being used as a convenient way to flank the enemy. The war that directly influenced this was the 1798 invasion by France and subsequent use as a battlefield throughout the Napoleonic Wars, particularly in 1799 and 1800.
The troops also served another purpose: to take care of armies that might want to take refuge in Switzerland during the war, that is to disarm them and make sure they do not rejoin their country until the end of the war, or if they don't want to accept these conditions to turn them back. This was particularly important during the war of 1870, when the 87'000-strong French Armée de l'Est sought protection as their retreat was cut off by German troops.
As for joining the war, I know that the wars between France and Germany tend to strain language relations in Switzerland, but to the best of my knowledge there was no real push to join the war on either side in 1870, unlike say in World War I. EDIT : apparently the Swiss Federal Council (government) studied the idea of occupying Northern Savoy when it became clear the Germans would win, but in the end decided not to take the risk.
Sources : Swiss Historical dictionary, Franco-Prussian war
Constant Guignard, Les Bourbakis : 1871, Editions le Pélerin, 1998