Johnston attended Abingdon Academy in Virginia, entering West Point in 1825. He graduated 13th in a class of 46 in 1829, and was appointed 2nd lieutenant in the 4th Artillery. After serving 8 years against Indians and on the frontier, he resigned to pursue a career as a civil engineer.
Johnston joined John Wesley Powell's expedition to Florida as an engineer, where, on January 15, 1838, the group was attacked by Indians. Despite wounds he had received during the attack, Johnston was able to lead the rearguard in a skillful retreat. As result of his heroism, he was appointed a 1st lieutenant in the Topographical Engineers. He was promoted to captain in 1846, served with distinction in Mexico under Gen. Winfield Scott, and then returned to the Topographical Engineers after the war. He progressed to lieutenant colonel in the 1st Cavalry in 1855, and, on June 28, 1860, to quartermaster general and brigadier general.
On April 22, 1861, he resigned from the U.S. Army, shortly after Virginia seceded from the Union. He offered his services to his state, and was initially appointed major general of Virginia troops. On May 14, he was brigadier general in the Confederate army, where his first assignment sent him to Harpers Ferry. There, he quietly withdrew before a superior Federal force under Brig. Gen. Robert Patterson, eluded pursuit, and by rail and on foot sent his men to reinforce Brig. Gen. P.G.T. Beauregard's forces at First Bull Run. Though assigned to the right flank, with orders to advance, he quickly shifted to the Confederate's sagging left flank, turning the tide of the battle. On August 31, he became a full general, to rank from July 4.
The appointment created a lasting animosity between Johnston and Pres. Jefferson Davis when Johnston complained that the appointment had placed him fourth (after Samuel Cooper, Albert Sidney Johnston, and Robert E. Lee) instead of first in seniority among full-rank generals. After having served as senior brigadier in the U.S. Army, he had expected to retain that position in the Confederacy.
Johnston, a consummate professional in his ability to plan, gather intelligence, and take defensive action, defended the Virginia Peninsula against Maj. Gen. George B. McClellan is spring 1862. Having observed the Federal build-up taking place around Yorktown, he recommended retrenching the army closer to Richmond. Davis, however, disagreed, and ordered Johnston to hold. On May 4, Johnston was finally forced to retreat, conducting a rearguard action May 5, to cover his withdrawl.
On May 31, at Seven Pines, Johnston struck McClellan. Though the offensive had been planned carefully, his subordinates failed to conduct orders efficiently, which led to the poor execution of his plans. Twice he was wounded during the battle, and left the army for several months to recuperate.
Johnston was placed in charge of the Department of the West upon his return to duty in November. His orders were to halt Brig. Gen. Ulysses S. Grant's advance in Mississippi. The ill-defined command, along with contradictory orders issued by Davis from Richmond, left Johnston unsure of his authority. Though he had advised Lt. Gen. John C. Pemberton to evacuate his entire army rather than risk losing his entire army, Pemberton refused, for Davis had ordered him to hold the city. Without sufficient manpower, Johnston was unable to relieve Pemberton once Grant had blocked access to Vicksburg. The garrison and the city were surrendered July 4.
After Gen. Braxton Bragg's failure at Chattanooga in December 1863, Johnston was assigned to the Army of Tennessee with instructions to reorganize it and take the offensive. The reorganization went well, but Johnston hesitated in taking the army, claiming he had insufficient manpower to oppose the powerful Federal army. He preferred to allow the enemy to attack him, thus giving him the opportunity to couterattack his weakened foe. In May 1864, pitted against Maj. Gen. William T. Sherman during the Atlanta Campaign, he depended upon this strategy. Davis, however, refused to approve. Johnston fell back skillfully through northern Georgia before a superior enemy force. Davis, frustrated with Johnston's inability to stop the Federal advance, relieved him of command July 17 in front of Atlanta. Lt. Gen. John B. Hood took over the command. A cautious soldier, Johnston had recorded neither great victories nor defeats, but had kept his army intact and safe from destruction.
Hood's failure to hold Atlanta, combined with his disastrous Franklin and Nashville Campaign, caused Gen. Robert E. Lee to restore Johnston to command February 23, 1865. He led the remnants of the once-formidable Army of Tennessee in the Carolinas Campaign through that spring. Following Lee's surrender in Virginia, Johnston negotiated an armistice with Sherman. On April 18, Davis ordered him South to continue the war, but, realizing the hopelessness of continued resistance, Johnston signed final terms for surrender on April 26, bringing his military career to a close.
After the war, Johnston lived in various southern cities and entered the insurance business. His memoirs, Narrative of Military Operations Directed During the Late War Between the States (1874), are justification of his military record. In 1878 he was elected from Virginia to a term in the U.S. House of Representatives, 1879-81; and 1885-91, held an appointment as commissioner of railroads during Grover Cleveland's administration. On March 21, 1891, he died in the District of Columbia.