The Battle of South Mountain—known in several early Southern accounts as the Battle of Boonsboro Gap—was fought September 14, 1862, as part of the Maryland Campaign of the American Civil War. Three pitched battles were fought for possession of three South Mountain passes: Crampton's, Turner's, and Fox's Gaps. Maj. Gen. George B. McClellan, commanding the Union Army of the Potomac, needed to pass through these gaps in his pursuit of Confederate General Robert E. Lee's precariously divided Army of Northern Virginia. Although the delay bought at South Mountain would allow him to reunite his army and forestall defeat in detail, Lee considered termination of the Maryland Campaign at nightfall.
South Mountain is the name given to the continuation of the Blue Ridge Mountains after they enter Maryland. It is a natural obstacle that separates the Hagerstown Valley and Cumberland Valley from the eastern part of Maryland.
After Lee invaded Maryland, a copy of an order, known as Special Order 191, detailing troop movements that he wrote fell into the hands of McClellan. From this, McClellan learned that Lee had split his forces, sending one wing under Maj. Gen. Thomas J. Jackson to lay siege to Harper's Ferry. The rest of Lee's army was posted at Boonsboro under command of Maj. Gen. James Longstreet. Lee hoped that after taking Harper's Ferry to secure his rear, he could carry out an invasion of the Union, wrecking the Monocacy aqueduct, before turning his attention to Baltimore, Philadelphia, or Washington, D.C. itself.
To counter the Confederate invasion, McClellan led the Army of the Potomac west in an effort to force battle on the isolated parts of Lee's divided force.
McClellan temporarily organized his army into three wings for the attacks on the passes. Maj. Gen. Ambrose Burnside, the Right Wing, commanded the I Corps (Maj. Gen. Joseph Hooker) and IX Corps (Maj. Gen. Jesse L. Reno). The Right Wing was sent to Turner's Gap and Fox's Gap in the north. The Left Wing, commanded by Maj. Gen. William B. Franklin, consisting of his own VI Corps and Maj. Gen. Darius N. Couch's division of the IV Corps, was sent to Crampton's Gap in the south. The Center Wing (II Corps and XII Corps), under Maj. Gen. Edwin Vose Sumner, was in reserve.
From Boonsboro, Lee had sent a column under Maj Gen. James Longstreet northward to respond to a perceived threat from Pennsylvania. After learning of McClellan's intelligence coup, Lee quickly recalled Longstreet's forces to reinforce the South Mountain passes and thus attempt to block McClellan's advance. On the day of the battle, the only Confederate force posted around Boonsboro was a five-brigade division under Maj. Gen. D.H. Hill.
The above is from Wikipedia.