Barto was born in Hinesburg, Vermont, in 1834. His father William Barto was from a French family which had emigrated to the United States before the American Revolution (their surname was originally spelled "Barteau"). His mother Mary Barto (née Gage) was a descendant of English settlers. Barto moved to Ferrisburgh, Vermont, to attend school. In 1854 he married Harriet E. Hitchcock. Shortly thereafter the two moved west, settling in Elgin, Illinois, where he ran a farm and later read law.[1]
During the American Civil War Barto enlisted in the 52nd Illinois Volunteer Infantry Regiment, serving for three years and mustering out with the rank of captain in October 1865. His first wife Harriet died shortly before Barto returned from his service. Barto resumed his life in Elgin, winning election as treasurer of Kane County, Illinois, for one term and remarrying in 1866 to Charlotte "Lottie" A. Allen.[1]