A Farewell to Arms is based on Ernest Hemingway’s own experiences in the Italian army in World War I. The primary setting for the book is Italy. The setting is important in an autobiographical sense because it’s historically accurate; it’s where Hemingway actually served.
It’s also crucial that the book not be set in the home country of the protagonist, Frederic Henry. Part of the plot involves Henry’s desertion from the army, as he chooses to run away to Switzerland with his love interest Catherine Barkley. If Henry deserted the army of his own country he would be perceived quite differently, probably as a coward. Since he is an American deserting the Italian army, it’s less likely to offend the sensibilities of an American audience. Hemingway needed that American audience.
The fact that the Italians appear to be doing a pretty lousy job of fighting a war also helps color Henry’s desertion as something more reasonable than we might usually expect.