"I am not a capitalist soldier; I am a proletarian revolutionist. I do not belong to the regular army of the plutocracy, but to the irregular army of the people. I refuse to obey any command to fight from the ruling class...I am opposed to every war but one; I am for that war with heart and soul, and that is the world-wide war of the social revolution. In that war I am prepared to fight in any way the ruling class may make necessary..." - Eugene V. Debs
Socialists do not take any absolute position on the question of war. We are not pacifists: we do not think all violence is wrong, nor do we think violence "degrades" the person/group exercising it; we do not equate the violence of the oppressor with the violence of the oppressed. If a Jew in Auschwitz picks up a gun and shoots a Nazi, we are all for it. If a Nazi picks up a gun and shoots a Jew, we are implacably opposed to it.
Every war must be judge separately; the classes involved on both sides must be examine, as well as their political objectives. As Clausewitz famously put it, "War is politics by other means." If we support the political objective of a particular group, we do not oppose that group if they resort to armed force (although we may oppose the group's tactic - i.e. the time for arms was not right).
We are for wars that further the interests of humanity as a whole, that liberate people, that further the development of mankind. Yet that sounds like a contradiction. How can war be beneficial to humanity?
The Civil War which ended slavery was a just war, a war that socialists would support. It was waged by the Northern capitalists in alliance with Southern blacks against the Southern slaveocracy. That war was progressive, because it liberated millions of slaves.
The war for the unification of Italy was also a war socialists would support, because it sought to create a nation state, which would facilitate capitalist development. Capitalist development would create the preconditions for socialism: industry (the ability to produce enough for all) and a working class (the social force capable of establishing a society without classes).
Thus, wars waged by capitalists were at one time progressive. The wars against feudalism, which raged in Europe in the 1800s, were just wars in the interests of humanity as a whole.
The era of progressive wars waged by the capitalists ended in 1871, when the workers of Paris took power, and the French and German armies (at the behest of the bourgeoisie of France) collaborated and drowned them in blood. The working class had become the revolutionary class, a threat to capital and capitalism, and the bourgeoisie had become a fetter on economic and historic progress.
During the next few decades, monopolies, trusts, and cartels developed; competition within states was replaced by competition between states - for markets, cheap labor, and raw materials. This was the beginning of what is known as imperialism. These wars are waged between rival capitalists of different countries (like WWI and WWII) or against the peoples of colonized nations (China, India in the 1800s).
None of these wars are in the interests of humanity. The immense creative power of capitalism - its factories, railroads, steamships - are used to slaughter millions of people and destroy massive amounts of wealth. These wars are not about liberation, these wars are between rival bands of robbers for booty.
Socialists are against all robbers, big or small, whether they fired the first shot or not. So in an imperialist war, we never support the capitalist government of either side. We call on the workers of both countries to overthrow their rules and to seize power from them. An example of this would be WWI, in which the Bolsheviks argued against the victory of "their" government, and called for the workers of Russia to overthrow the Tsar and capitalism.
But not all wars in the era of imperialist warfare are wars between rival imperialists. The U.S. war against Viet Nam was a war between an imperialist power and a national liberation movement. Socialists supported the war being waged by the National Liberation Front (NLF, or commonly known as the Vietcong), despite the fact that we knew they would establish a state capitalist regime after they had won. For us, the matter of what kind of government Viet Nam was to have was the business of Viet Nam and no one else. If the Vietnamese workers and peasants wanted to settle account with their rulers, that was their business; the U.S. should have no part of that decision. During the war, socialists called for the defeat of the U.S. and for the victory of the NLF, because we were opposed to the aims of "our" government.
We support wars for democracy, and/or against fascism. Socialists would've taken up arms in the Spanish Civil War to defeat Franco. In fact, they did, by the thousands.
World War II, however, was not a war between "democracy" and fascism - as it is portrayed by the media and the rulers. The myth is that the U.S. went to war to save the Jews, to fight Nazism and fascism, and to liberate the world. The notion that the U.S. "had" to join the war because of Pearl Harbor, and that the U.S. dropped the atomic bomb to "save American" (and Japanese) lives is also part of that myth.
All of it is complete and utter nonsense. The Allied forces repeatedly refused to bomb the rail lines to Auschwitz and the other death camps. They also refused to send arms to the heroic fighters of the Warsaw Ghetto, who rose up against Nazi rule in 1942. The Allies never attacked Franco in Spain, even though he was clearly a fascist, and a butcher of the working class. The U.S. certainly did not liberate the world; after all, it supported France's claim on Viet Nam, Laos, and Cambodia, even though Ho Chi Minh and other nationalist groups appealed for indepence repeatedly.
In addition, the U.S. knew the attack on Pearl Harbor was coming and did nothing; the politicians and generals pursued a deliberate policy with the goal of provoking a response from Japan, in order to cement public support for the U.S. entry into the war. (Read a new book called "Day of Deceit", written by a George Bush Sr. supporter, not some lefty!) The U.S. dropped the atomic bomb even though the top military brass admitted that Japan would surrender, and that a ground invasion would not millions, as was later claimed. The bomb was dropped to send a message to the USSR that the US would be the big bully of the playground, not them. And millions paid with their lives as a result.
In short, we are opposed to all imperialist wars. We understand that the real enemy is at home. We are for only one war - the class war of workers against the bosses.