Born in Queensbury, New York, Barber moved to Horicon, Wisconsin in 1846. He attended the University of Wisconsin at Madison. He studied law in Albany, New York. He was admitted to the bar in 1856 and commenced practice at Juneau, Wisconsin. He served as prosecuting attorney of Jefferson County, Wisconsin in 1861 and 1862. He served as assistant attorney general of Wisconsin in 1865 and 1866. He moved to Chicago, Illinois, and resumed the practice of law in 1866.
Barber was elected as a Republican to the Forty-sixth Congress (March 4 1879-March 3 1881). He was an unsuccessful candidate for renomination in 1880. He was receiver of the land office at Mitchell, South Dakota from 1881 to 1888. He returned to Chicago and continued the practice of law. He served as master in chancery of the Cook County Superior Court from 1891 to 1914. He retired from public life and active business pursuits. He died at Lake Geneva, Wisconsin, and was interred in Juneau Cemetery, Juneau, Wisconsin.