I always assumed it was about the Spanish Civil War, to which many young people gravitated out of a misplaced sense of social justice.
Earnest Hemingway participated (as a ambulance driver) to get material for his future as a writer. Idealism (on the other side) about the Spanish Civil War plays a role in The Prime Of Miss Jean Brodie, by Muriel Spark.
I don’t think the war in question is the Spanish Civil War because they sing of crossing the Rio Grande and not the Rio Bidasoa. So it could even be the US Civil War.