For example, during the American Revolution, was there any correspondence between Masons in Britain and the Colonies? How did they view each other?
Another example would be WWI. It would seem reasonable to assume that Masons served in both the Alliance and the Entente.
There are quite a few first-hand accounts of Freemasons extending Masonic courtesy to each other across national divisions during wars.
This is a good article.
Gettysburg National Cemetery has a Masonic Memorial to the concept as well.
I recall reading a story of a unit of American Masons providing an on the spot Masonic funeral to a German tanker in Africa during WWII. Source
In keeping with how divisive of a conflict it was, WWI led to quite a bit of international angst between the lodges of the various countries, with them cutting off recognition of each other. Source This may or may not have impacted how individuals would have treated other Masons on the opposing side.
You might find this paper on Masonry amongst prisoners of war from the Napoleonic era to present, also interesting.