They were fighting because they were conscripted into the military and would have been punished by the law had they refused. There were not fighting the war for ideology's sake, that view is the result of the cold war and neo-conservative justifications for war and conflict - spread muh freedum, muh democracy. Previously people had been motivated to join wars through nationalism, religion, or culture (your country needs you, defeat the heretics, enlighten the savages etc.)
The truth is that wars are almost universally fought for economic or strategic purposes. The propaganda just takes an ideological, nationalistic, cultural, racial, or religious angle based on whatever is culturally dominant at the time of the war, and will inspire the greatest support for it.
Regardless of all that, the US and Europe were, prior to WWII, all heavily racist and arguably white nationalist. They had discriminatory immigration policies, enforced segregation in places where there were large non-white populations, and had societies that would be considered hardline conservative, racist, homophobic, and sexist by today's standards. The state of American and Western European society today would have many of these soldiers spinning in their graves.