Born in Marshall, Michigan, Hayes attended the common schools and was graduated from the law department of the University of Michigan at Ann Arbor in 1863. He was admitted to the bar in 1863 and commenced practice in Marshall, Michigan. City attorney 1864 and 1865. United States commissioner for the eastern district of Michigan 1864 and 1865 and of Iowa 1865-1875. City solicitor of Clinton, Iowa, in 1870. He served as district judge of the seventh judicial district of Iowa 1875-1887. He served as delegate to the Democratic National Conventions in 1884 and 1892.
Hayes was elected as a Democrat to the Fiftieth and to the three succeeding Congresses (March 4, 1887-March 3, 1895). He served as chairman of the Committee on Education (Fifty-second Congress). He was an unsuccessful candidate for reelection in 1894 to the Fifty-fourth Congress. He resumed the practice of law in Clinton, Iowa. He served as member of the State house of representatives in 1897 and 1898. He died in Marshall, Michigan, March 14, 1901. He was interred in Springdale Cemetery, Clinton, Iowa.