Johnston's father, Peter Johnston, had served in the American Revolution with Henry “Lighthouse” Lee (the father of Robert E. Lee), and both sons were classmates at West Point. Johnston served with distinction in the Seminole and Mexican wars, being wounded five times during the latter.
After the Mexican War he was chief of the topographical
engineers in Texas and during 1855–1860 was assigned as a lieutenant colonel of the 1st Cavalry. Promoted to brigadier general, Johnston became Quartermaster General of the U.S. Army, a position he held until May 1861. Upon the secession of Virginia from the Union, he resigned his commission and became a brigadier general and soon after a general in the Confederate service.
In July 1861 General Johnston, commanding the Army of the Shenandoah, eluded a Union force under Maj. Gen. Robert Patterson in the Shenandoah Valley and rushed to reinforce Beauregard's Army of the Potomac at Manassas Junction. Johnston assumed overall command but elected to allow Beauregard to command the Confederate forces actually engaged. Although the senior commander on the field, Johnston received less publicity for his role during the battle than the more colorful, self-promoting Beauregard.
In the spring of 1862 Johnston moved his army to the Peninsula, between the James and York rivers, when Union forces under Maj. General George B. McClellan landed at Fort Monroe. At the Battle of Fair Oaks (31 May 1862) he was twice wounded and carried from the field.
Johnston had recovered sufficiently by November to report for duty. By that time General Robert E. Lee was commanding Johnston's forces, and he was assigned authority over the territory between the Appalachians and the Mississippi River. This authority was vague, with department heads reporting directly to Richmond rather than to Johnston.
Joseph E. Johnston