There are probably a number of well-known poems written by soldiers who later died in battle.

John McCrae, the doctor who wrote "In Flanders Fields", didn't die in battle, he died of pneumonia and meningitis in January, 1918.

The poem "High Flight", which was adopted by the Royal Canadian Air Force as its official poem, was written by John Gillespie McGee (MacGee?). I had always assumed McGee was a Canadian because he flew with the RCAF, but the only mention of his nationality I could find on Google is "an American/British pilot who flew with the RCAF". He wasn't killed in battle either (and he was WWII, not WWI); he died in a training accident in Lincolnshire, England on December 11, 1941. (There were a lot of Americans, especially of British descent, who signed up with the Canadians prior to the US entry into the war; McGee was probably one of them.) The poem was found among his personal effects after his death, as part of a letter to his parents that he never got a chance to send.

Strangely enough, the Canadian Department of Veteran's Affairs website has a full write-up on John McCrae, but searches on "High Flight", "John Gillespie McGee", "Gillespie", "MacGee" and "McGee" turned up no mention of the latter poem or its author. <img src="/images/graemlins/mad.gif" alt="" />
_________________________
"The mind is not a vessel to be filled but a fire to be kindled."
-Plutarch