Born in Farmville, Virginia, Johnston attended West Point, graduating with the Class of 1829. When he resigned his commission in 1861, he was the highest-ranking Union officer to do so. He was at first in charge of the Army of Northern Virginia. However, he was wounded during the 1862 Peninsular Campaign, and command was eventually given to General Robert E. Lee. In 1863 he was unsuccessful in relieving the crucial town of Vicksburg, Mississippi, partly due to conflicting orders. Then, commanding the Army of the Tennessee, he delayed Major General William T. Sherman's advance from Chattanooga to Atlanta, but quarreled with the Confederate President, Jefferson Davis, who removed him during the Siege of Atlanta. Faced with an opposing army of overwhelming strength, Johnston fought a strategic retreat halfway across Georgia. His replacement, General John Bell Hood, was very ineffective, losing a large portion of his men in the Tennessee Campaign, after attacking well-entrenched Nashville, which was occupied by Major General George Thomas's Union army. After learning of the surrender at Appomattox Courthouse, Johnston surrendered his army on April 26, 1865, despite orders to the contrary from Jefferson Davis.
After the war Johnston served a term as the Representative from Virginia and was a commissioner of railroads in the administration of United States President Grover Cleveland. His critical analysis of the Civil War, Narrative of Military Operations, was well received.