During the campaign, Colonel Riker was wounded at the Battle of Pine Mountain, Georgia, in late June 1864. He was carried back from the front line by another soldier who was actually discovered, in 2372, to be a Q who eventually referred to himself as "Quinn". They were photographed together shortly after this incident.
Without the actions of Quinn, there would have been no William T. Riker, which would have allowed the Borg to assimilate the Federation. (VOY: "Death Wish")
The backstory of Thaddius Riker was "borrowed", much like the image, from the real life soldier who "portrayed" the character, Lewis R. Stegman. Stegman, like Riker, commanded the 102nd New York Regiment that fought in the Atlanta Campaign under Sherman in 1864, where he was too injured at the Battle of Pine Mountain.
In the first draft script of "Death Wish", this character was instead an unnamed great, great grandfather of Geordi La Forge. As explained by La Forge, this ancestor of his was "a pilot for the NATO Air Force during the Albanian Incursion." In 2011, the airman's ship was shot down in the Battle of Kerkira and he was thereafter rescued from the Adriatic Sea; wounded, he was pulled from his burning plane by the Q who later named himself Quinn. In a scripted scene description, La Forge's photographed ancestor was said to be part of a three-men team who, in the picture, were in a raft and were shown being rescued from the water. The airman himself was described as "happy, but wounded" in the image.