John Gray Foster (May 27, 1823 – September 2, 1874) was an American soldier. A career military officer in the United States Army and a Union general during the American Civil War, he served in North and South Carolina during the war. A postbellum expert in underwater demolition, he wrote a treatise on the subject in 1869. He continued with the Army after the war, using his expertise as assistant to the Chief Engineer in Washington, DC and at a post on Lake Erie.