At the outset of the American Civil War, Bierce enlisted in the Union Army's 9th Indiana Infantry. He participated in the operations in Western Virginia (1861), was present at the Battle of Philippi (the first organized land action of the war), and received newspaper attention for his daring rescue, under fire, of a gravely wounded comrade at the Battle of Rich Mountain. Bierce fought at the Battle of Shiloh (April 1862), a terrifying experience that became a source for several short stories and the memoir "What I Saw of Shiloh".
In April 1863 he was commissioned a first lieutenant, and served on the staff of General William Babcock Hazen as a topographical engineer, making maps of likely battlefields. As a staff officer, Bierce became known to leading generals such as George H. Thomas and Oliver O. Howard, both of whom supported his application for admission to West Point in May 1864. General Hazen believed Bierce would graduate from the military academy "with distinction" and William T. Sherman also endorsed the application for admission even though stating he had no personal acquaintance with Bierce. In June 1864, Bierce sustained a serious head wound at the Battle of Kennesaw Mountain, and spent the rest of the summer on furlough, returning to active duty in September. He was discharged from the army in January 1865.
His military career resumed, however, in mid-1866, when he joined General Hazen as part of an expedition to inspect military outposts across the Great Plains. The expedition traveled by horseback and wagon from Omaha, Nebraska, arriving toward year's end in San Francisco, California.