Born near Upper Marlboro, Maryland, Townshend moved to Washington, D.C., in 1846. He attended public and private schools. Page in the House of Representatives. He moved to Cairo, Illinois, in 1858. He taught school in Fayette County. He studied law. He was admitted to the bar in 1862 and commenced practice in McLeansboro, Illinois. He served as clerk of the circuit court of Hamilton County 1863-1868. He served as prosecuting attorney for the twelfth judicial circuit of Illinois 1868-1872. He served as member of the Democratic State central committee in 1864, 1865, 1874, and 1875. He served as delegate to the Democratic National Convention in 1872. He moved to Shawneetown, Illinois, in 1873 and resumed the practice of law.
Townshend was elected as a Democrat to the Forty-fifth and to the six succeeding Congresses and served from March 4, 1877, until his death in Washington, D.C., March 9, 1889. He served as chairman of the Committee on Expenditures in the Department of the Navy (Forty-sixth Congress), Committee on Military Affairs (Fiftieth Congress). He was interred in Rock Creek Cemetery.