Cain worked as a barber in Galena, Illinois, and worked on steamboats along the Ohio River before he migrated south. He had been licensed to preach for the Methodist Episcopal Church in 1844. His first assignment was in Hannibal, Missouri. In 1848, frustrated by the segregationist policies of the Methodists, he joined the African Methodist Episcopal Church, an independent black denomination started in Philadelphia. By 1859 he became a deacon in Muscatine, Iowa. In 1861, Cain was called as a pastor at the Bridge Street Church in Brooklyn, New York. In 1862, he was ordained as an elder in 1862 and remained at the Brooklyn church until 1865. After the Civil War, Cain moved to Charleston, South Carolina, in 1865 as superintendent of AME missions and presided over the Emmanuel Church in that city. The AME Church attracted tens of thousands of converts to its denomination very rapidly. Cain became active in politics, serving as a delegate to the state constitutional convention in 1868. He represented Charleston County in the South Carolina Senate from 1868 to 1872. He also edited the South Carolina Leader newspaper. As editor, he hired future congressmen Robert B. Elliott and Alonzo Ransier. He was elected as a Republican to the Forty-third United States Congress in a newly created at-large district. He was on the Committee on Agriculture, but focused more on the civil rights bill which eventually passed in diluted form in 1875. He gave noted speeches on the bill in January, 1873. He did not run for re-election in 1874 after redistricting, but ran for the 2nd district in 1876. He was elected to the Forty-fifth United States Congress. In 1877, while advocating in Congress for mail service to West African Colonies, Cain became a member of the Liberian Exodus Joint Stock Steamship Company. In 1880, Cain was elected and consecrated a bishop in the African Methodist Episcopal Church; he served the episcopal district which comprised Louisiana and Texas. He helped found Paul Quinn College and served as its president until 1884. Cain then moved to Washington, D.C., where he served as AME bishop over the Mid-Atlantic and New England States. He died in Washington on January 18, 1887, and was buried in Graceland Cemetery there, but may have been removed to Woodlawn Cemetery about a decade later, when Graceland closed and many of its interments were reburied in Woodlawn.