Ewell served in the New Mexico Territory for some time, exploring the newly acquired Gadsden Purchase with Colonel Benjamin Bonneville. He was wounded in a skirmish with Apaches under Cochise in 1859. In 1860, while in command of Fort Buchanan, Arizona, illness compelled him to leave the West for Virginia to recuperate. He described his condition as "very ill with vertigo, nausea, etc., and now am excessively debilitated[,] having occasional attacks of the ague. Illnesses and injuries would cause difficulties for him throughout the upcoming Civil War.
Ewell inspired his men in spite of, not because of, his appearance. Historian Larry Tagg described him:
Ewell superbly commanded a division in Jackson's small army during the Valley Campaign, personally winning quite a few battles against the larger Union armies of Maj. Gens. John C. Frémont, Nathaniel P. Banks, and James Shields. Jackson's army was then recalled to Richmond to join Robert E. Lee in protecting the city against Maj. Gen. George B. McClellan's Army of the Potomac in the Peninsula Campaign. Ewell fought conspicuously at Gaines' Mill and Malvern Hill. After Lee repelled the Union army in the Seven Days Battles, Union Maj. Gen. John Pope's Army of Virginia threatened to attack from the north, so Jackson was sent to intercept him. Ewell defeated Banks again at the Battle of Cedar Mountain on August 9 and, returning to the old Manassas battlefield, he fought well at the Second Battle of Bull Run, but was wounded at Groveton and his left leg was amputated below the knee.
While recovering from his injury, Ewell was nursed by his first cousin, Lizinka Campbell Brown, a wealthy widow from the Nashville area. Ewell had been attracted to Lizinka since his teenage years and they had earlier flirted with romance in 1861 and during the Valley Campaign, but now the close contact resulted in their wedding in Richmond on May 26, 1863.
After his long recovery, Ewell returned to Lee's Army of Northern Virginia for the Battle of Chancellorsville. When Jackson was mortally wounded on May 3, 1863, he suggested that Ewell replace him in corps command. Lee temporarily filled the position with J.E.B. Stuart, his cavalry commander, but on May 23, Ewell was promoted to lieutenant general and command of the Second Corps (now slightly smaller than Jackson's because units were subtracted to create a new Third Corps, under Lt. Gen. A.P. Hill, also one of Jackson's division commanders).
But at the Battle of Gettysburg, Ewell's military reputation started a long decline. On July 1, 1863, Ewell's corps approached Gettysburg from the north and smashed the Union XI Corps and part of the I Corps, driving them back through the town and forcing them to take up defensive positions on Cemetery Hill south of town. Lee had just arrived on the field and saw the importance of this position. He sent discretionary orders to Ewell that Cemetery Hill be taken "if practicable." Historian James M. McPherson wrote, "Had Jackson still lived, he undoubtedly would have found it practicable. But Ewell was not Jackson. Ewell chose not to attempt the assault.
Ewell had several possible reasons for not attacking. The orders from Lee contained an innate contradiction. He was "to carry the hill occupied by the enemy, if he found it practicable, but to avoid a general engagement until the arrival of the other divisions of the army. Lee also refused to provide assistance that Ewell requested from the corps of A.P. Hill. Ewell's men were fatigued from their lengthy marching and strenuous battle in the hot July afternoon and it would be difficult to reassemble them into battle formation and assault the hill through the narrow corridors afforded by the streets of Gettysburg. The fresh division under Maj. Gen. Edward "Allegheny" Johnson was just arriving, but Ewell also received intelligence that heavy Union reinforcements were arriving on the York Pike from the east, potentially threatening his flank. Ewell's normally aggressive subordinate, Maj. Gen. Jubal A. Early, concurred with his decision.
Lee's order has been criticized because it left too much discretion to Ewell. Historians such as McPherson have speculated on how the more aggressive Stonewall Jackson would have acted on this order if he had lived to command this wing of Lee's army, and how differently the second day of battle would have proceeded with Confederate possession of Culp's Hill or Cemetery Hill. Discretionary orders were customary for General Lee because Jackson and James Longstreet, his other principal subordinate, usually reacted to them very well and could use their initiative to respond to conditions and achieve the desired results. This failure of action on Ewell's part, whether justified or not, in all likelihood cost the Confederates the battle. When Ewell's corps did attack these positions on July 2 and July 3, the Union had had time to fully occupy the heights and build impregnable defenses, resulting in heavy Confederate losses. Post-war proponents of the lost cause movement, particularly Jubal Early, but also Maj. Gen. Isaac R. Trimble, who had been assigned to Ewell's staff during the battle, criticized him bitterly in attempts to deflect any blame for the loss of the battle on Robert E. Lee. Part of their argument was that the Union troops were completely demoralized by their defeat earlier in the day, but Ewell's men were also disorganized, and decisions such as they were propounding are far simpler to make in hindsight than in the heat of battle and fog of war.
On July 3, Ewell was once again wounded, but this time only in his wooden leg. He led his corps on an orderly retreat back to Virginia. His luck continued to be poor and he was wounded at Kelly's Ford, Virginia, in November. He was injured again in January 1864, when his horse fell over in the snow.
Lee reasoned that Ewell's lingering injuries were the cause of his problems and he relieved him from corps command, reassigning him to command the garrison of the Department of Richmond, which was by no means an insignificant assignment, given the extreme pressure Union forces were applying to the Confederate capital. In 1865, Ewell was retreating from Richmond when his rag-tag force was surrounded and captured at Sayler's Creek, a few days before Lee's surrender at Appomattox Court House. He was held as a prisoner of war at Fort Warren in Boston Harbor until July 1865.