 After the death of U.S. Representative Wilder D. Foster on September 20, 1873, Williams was elected November 4, 1873 as a Republican to fill the vacancy.Williams was elected to represent Michigan's 5th congressional district in the 43rd Congress, serving from December 1, 1873 to March 3, 1877.He was not a candidate for re-nomination in 1876.