Born in Pike County, Indiana, and raised in Evansville, he was a lawyer. During the American Civil War, he was a general officer for the Union. The Civil war ended in 1865. Between 1865 and 1869, Foster worked as a journalist for the "Evansville Daily Journal". After that, he was the U.S. Minister to Mexico (1873-1880), Russia (1880-1881) and Spain (1883-1885). He was U.S. Secretary of State under President Benjamin Harrison from 1892-1893. In 1895, he helped the Qing Dynasty in drafting the Treaty of Shimonoseki of 1895. He worked for the Chinese as a legal consultant and commissioner.