John Gray Foster was born on May 27, 1823, in Whitefield, New Hampshire. He was the first-born of seven children of Major Perley Foster and Mary Gray. Foster’s father served as ship’s carpenter on Commodore Oliver Hazard Perry’s flagship on Lake Erie during the War of 1812.
Young Foster spent his early years in Whitefield, before moving with his family to Nashua, New Hampshire, when he was approximately ten years of age. While living there, he attended the Hancock Academy and at Crosby’s Nashua Literary Institute.
U.S. Military Academy
U.S. Representative Charles G. Atherton appointed Foster to the United States Military Academy, where Foster enrolled on July 1, 1842. Among his classmates were future Union General George Stoneman and future Confederate Generals Thomas J. (Stonewall) Jackson and George E. Pickett. Foster proved to be an excellent student at West Point, graduating fourth in his class of fifty-nine cadets on July 1, 1846. Upon graduation, officials brevetted Foster to second lieutenant and assigned him as an assistant engineer with the Army Corps of Engineers, stationed in Washington, D.C.
Like many future Civil War general officers, Foster gained invaluable combat experience during the Mexican-American War (April 25, 1846–February 2, 1848). During that conflict, he was engaged at the Siege of Veracruz (March 9‑29, 1847), the Battle of Cerro Gordo, (April 17‑18, 1847), the Battle of Contreras (August 19‑20, 1847), and the Battle of Churubusco (August 20, 1847). In recognition of his “Gallant and Meritorious Conduct” at Contreras and Churubusco, officials brevetted Foster to first lieutenant, effective August 20, 1847. On September 8, 1847, Mexican troops severely wounded Foster during the Battle of Molino del Rey. Disabled by his injuries, army officials as placed Foster on leave for several months and brevetted to him captain, effective September 8, 1847.
Following the Mexican-American War, Foster was engaged in many engineering projects for the Corps of Engineers. On May 24, 1848, officials promoted him to the full rank of second lieutenant. Six years later, they advanced to him first lieutenant on April 1, 1854. From January 11, 1855 to June 27, 1857, Foster returned to West Point as an assistant professor of engineering. In 1857, he worked on several coastal improvement projects, including the completion of Fort Sumter and repairs to Fort Moultrie in Charleston Harbor in South Carolina. On July 1, 1860, Foster received a promotion to captain in recognition of “Fourteen Years’ Continuous Service” with the army.
Sometime during the 1850s, Foster married Mary L. Moale. Their marriage produced one daughter, Anne Moale Foster. The fate of Mary remains a mystery, but records suggest that Foster later married Anna Johnson.
The beginning of the Civil War found Foster engaged in strengthening the fortifications in Charleston Harbor. Expecting a Confederate assault, Foster took part in transporting the federal garrison at Fort Moultrie to the more defensible Fort Sumter on December 26, 1860. For his leadership during the transfer, officials brevetted Foster to major, effective December 26, 1860. When hostilities eventually erupted, Foster served throughout the bombardment of Fort Sumter from April 12 through April 14, 1861.
Following the evacuation of Fort Sumter, Foster assisted with several engineering projects in the East. He declined a promotion to major with the 11th U.S. Infantry on May 14, 1861, but he accepted a commission as a brigadier general in the volunteer army on October 23, 1861.
Service in North Carolina
On December 20, 1861, officials placed Foster in command of the 1st Brigade of Major General Ambrose Burnside’s Coast Division. His brigade took part in Burnside’s North Carolina Expedition, beginning in early 1862. On February 8, 1862, Foster received a brevet promotion to lieutenant colonel in the regular army for “Gallant and Meritorious Services in Capture of Roanoke Island.” After the capitulation of Fort Bartow on Roanoke Island, the Union renamed the Confederate stronghold as Fort Foster in Foster’s honor. Foster subsequently took part in the subjugation and occupation of New Bern, Morehead City, Beaufort, and Washington, North Carolina. On March 12, 1862, officials brevetted Foster to colonel in the regular army for “Gallant and Meritorious Services in Capture of Newberne, N. C.”
When Burnside reorganized his forces on April 2, 1862, he gave Foster a divisional command. In early July, the War Department ordered Burnside to Virginia along with most of his troops to assist with Major General George B. McClellan’s faltering Peninsula Campaign. Foster remained behind with 7,000 soldiers to hold what Burnside had gained in North Carolina. On July 1, 1862, the War Department placed Foster in command of the Department of North Carolina. Commensurate with his new position, Foster received a promotion to major general of volunteers on July 18, 1862. For the next year, Foster’s small force, known as the 18th Army Corps, maintained a Union foothold in Coastal Carolina.
On March 14, 1863, officials promoted Foster to major in the regular army. Four months later, the War Department assigned him to command the newly created Department of Virginia and North Carolina, effective July 15, 1863. He served as commander of that department until November 13.
Department of the Ohio Commander
In November 1863, Major General Ambrose Burnside asked to be relieved of his command of the Department of the Ohio because of illness. On November 16, the War Department issued General Orders Number 369, relieving Burnside of his command and replacing him with Foster.
Foster’s tenure as commander of the Department of the Ohio lasted only two months, until February 9, 1864, when he stepped down after sustaining serious injuries after falling from his horse. Following his accident, Foster went on sick leave until May 5, 1864.
Department of the South Commander
When Foster returned to active duty, officials placed him in command of the Department of the South, which comprised areas of Florida, Georgia, and South Carolina occupied by federal troops. He served in that capacity until February 11, 1865. During his tenure, Foster assisted Major General William T. Sherman’s March to the Sea by making demonstrations along the coast that diverted attention from Sherman’s troops. On March 13, 1865, officials brevetted Foster to brigadier general in the regular army “for Gallant and Meritorious Services in the Capture of Savannah, Ga.” On the same date, he received a brevet promotion to major general in the regular army “for Gallant and Meritorious Services in the Field during the Rebellion.”
Department of Florida Commander
On August 7, 1865, Foster took command of the new Department of Florida, which embraced the whole State of Florida, in the Military Division of the Gulf. A little over one year later, he mustered out of the volunteer army on September 1, 1866, but he remained on as commander of the Department of Florida as an officer in the regular army until December 5.
In January 1867, army officials assigned Foster to the Engineer Bureau, in Washington, D. C. Two months later, they promoted him to lieutenant colonel with the Corps of Engineers on March 7, 1867. Foster served as an army engineer, working on internal improvement projects, until his death seven years later. Following an extended illness, Foster died at his home in Nashua, New Hampshire, on September 2, 1874, at the age of fifty-one. He was buried at Nashua Cemetery.