In the 1850s, Anderson turned his focus to railroad operations. In 1851, he supervised the construction of a road from New Albany to Corydon, Indiana. In 1852, he was chosen chief engineer of a proposed road from the Ohio River, below the falls to Sandusky, Ohio; and then for three years, ending in 1858, he was General Superintendent of the New Albany and Salem Railroad. All this was accomplished while still operating his educational institutions. As his railroad work took more and more of his time, Anderson gradually withdrew from teaching. Finally, after 1858, he devoted himself wholly to railroading.
In November 1858, Anderson accepted the office of Superintendent for the Middle Division of the Pennsylvania Railroad. In February 1859, he was advanced to the General Superintendency of the Pittsburgh, Fort Wayne and Chicago Railway. In less than a year, however, Anderson was called to be Superintendent of Transportation on the Louisville and Nashville Railroad, a position in which the opening of the American Civil War found him.
Civil War
During the Civil War, he served in the Union Army as superintendent of various railroads, first as a civilian and later with the rank of colonel. In November 1861, General William Tecumseh Sherman appointed John Anderson as Railroad Director for the Department of the Ohio. In February 1862, Anderson was succeeded in this position by Daniel McCallum, after the creation of the United States Military Railroad. Subsequently, in November 1862, General William Rosecrans appointed Anderson military superintendent of railroads for the Department of the Cumberland. McCallum relieved him of this duty in 1864.
Postbellum
In 1864, Anderson left the Army and became interested in the Union Pacific Railway, Eastern Division, then being planned on a route through Kansas. He apparently never assumed control of the railroad's construction, as urged by the company's president John Perry, but he did become financially involved. In 1868, he and his wife moved to Junction City, Kansas, where his nephew John Alexander Anderson was serving as a preacher. In 1873, his nephew became president of Kansas State Agricultural College in Manhattan, Kansas, and in 1880, John Byers Anderson also moved to Manhattan, where he would remain for the rest of his life. While in Manhattan, Anderson served as president of the First National Bank of Manhattan. In the 1880s, Anderson also served as president of the board of trustees of the College of Emporia in Emporia, Kansas. In 1888, on the occasion of his 50th wedding anniversary, he established the Anderson Memorial Library at the college through a donation of his book collection. John Byers Anderson died at Manhattan on July 25, 1897. After his death, in 1908 his large Manhattan home was purchased to serve as the first Catholic school in the town, later called the Sacred Heart Academy. In 1901, Andrew Carnegie donated $30,000 to the College of Emporia in memory of Col. Anderson, who had years earlier allowed Carnegie and other boys to use his library in Pennsylvania's, and inspired Carnegie's self-improvement and lifelong learning.