 He was active in the anti-slavery movement, and in 1848 he was one of the founders of the Free Soil Party.Walker served in the Massachusetts House of Representatives in 1849 and 1860, in the Massachusetts State Senate in 1850, as Massachusetts Secretary of the Commonwealth 1851–1853, and in the United States House of Representatives 1862–1863, where he was elected as a Republican to fill the vacancy caused by the death of Goldsmith Bailey.In 1853, he was chosen a member of the convention for revising the state constitution, becoming the chairman of the committee on suffrage.