Barnum also served as a politician.
When Barnum was elected as a Republican to the Connecticut General Assembly in 1865, Barnum entered politics for the first time. He rapidly became one of the legislature's most ardent proponents of equal rights and American suffrage despite his prior ownership of the slave Joice Heth's origins in Africa. Then, ironically, he tried to run for the US Congress against a distant relative also named Barnum, but he failed after a contentious campaign. After serving a short time as mayor of Bridgeport, Connecticut, where he had grown up, Barnum later returned to the Connecticut Legislature in the late 1870s and rose to prominence as a strong supporter of pro-moderate changes and end of the use of the death penalty.
He was the legislative patron of a law enacted by the Connecticut General Assembly in 1879 prohibiting the use of "any drug, remedy, or device intended to prevent conception", and also considered it a crime when acting as an accessory to contraceptive use. This law remained in effect in Connecticut until it was overturned by the United States Supreme Court in 1965 in Griswold v. Connecticut. He ran for Congress in 1867 and lost to his third cousin, William Henry Barnum. In 1875, he served as mayor of Bridgeport, Connecticut to improve water supplies, bring gas lighting to the streets, and enforce alcohol and prostitution laws. He was instrumental in founding Bridgeport Hospital, which was founded in 1878, and was its first president.