Ewell was born in Georgetown, D.C. He graduated from West Point in 1840, thirteenth in his class. He was commissioned in the 1st Dragoons, then became a 1st Lieutenant in 1845. In the Mexican War, he was recognized and promoted to captain. He served in the New Mexico Territory for some time, before resigning his commission in 1861 to join the Confederacy.
He was given command of a cavalry regiment, then promoted to brigadier general on June 17. He commanded a brigade at the First Battle of Bull Run, but saw little action. In January 1862, he was promoted to major general, and began serving under General "Stonewall" Jackson during the Valley Campaign. Although, at first, he was bitter about Jackson's tendency to leave his subordinates blind about his next moves, Ewell later warmed up to him (somewhat).
He commanded superbly during the Valley Campaign, personally winning quite a few battles against Union General John C. Frémont's large army. Jackson was then recalled to Richmond to protect the city against General George B. McClellan's Army of the Potomac, which was advancing up the James River Peninsula. After repelling the Union army, General John Pope's Army of Virginia threatened to attack from the north, so Jackson was again recalled to the site of the 1st Battle at Bull Run. However, at the Second Battle of Bull Run, Ewell lost a leg.
After a long recovery, he returned to duty in May of 1863, and was given command of Jackson's corps after the latter died at the Battle of Chancellorsville. At the 2nd Battle of Winchester, Ewell performed superbly, leading to comparisons with Jackson. However, at the Battle of Gettysburg, Ewell was given discretionary orders (as was General Robert E. Lee's tendency, because Jackson would always carry them out superbly), and failed to follow up his great advantage on the first day. This most probably cost the Confederates the battle.
He served in the Battle of the Wilderness, where this problem prevailed. His corps was mauled at the Battle of Spotsylvania Courthouse, and was forced to give up command due to illness. However, he was relieved from his corps command, and given a command in the defense of Richmond. He was captured at Sayler's Creek, a few days before Lee's surrender at Appomattox Courthouse.