Heth was born at Black Heath, in Chesterfield County , Virginia, on December 16, 1825, into a family with a solid military pedigree. His paternal grandfather, Henry Heth, had been a colonel during the American Revolution (1775–1783), while his father, John Heth, was a navy captain who was briefly captured during the War of 1812 . One of Heth's cousins was Confederate general George Pickett. Heth was denied entrance to the U.S. Naval Academy and instead was graduated from the U.S. Military Academy at West Point in 1847, finishing, like his cousin, at the bottom of his class. He served during the Mexican War (1846–1848), although he arrived well after active operations had ended. After returning to the United States, he saw active service fighting Native Americans on the western frontier (he led a successful flanking maneuver against the Sioux in the 1855 Battle of Ash Hollow, in present-day Nebraska) and in 1858 wrote the army's first marksmanship manual, A System of Target Practice (1862).

After Virginia's secession from the Union on April 17, 1861, Heth resigned his U.S. Army commission and briefly headed the state's quartermaster department before assuming command of the 45th Virginia Infantry Regiment. He then participated in the unsuccessful western Virginia campaign conducted by Brigadier General John B. Floyd during the second half of 1861. In January 1862, Heth accepted a promotion to brigadier general, and a few months later his brigade was sent to East Tennessee to assist Confederate forces in that region. There, during the autumn of 1862, he participated in the Kentucky Campaign that culminated in the Battle of Perryville, although Heth was not present at the battle.

Heth and his command were transferred east in February 1863 and assigned to a division in the Army of Northern Virginia's Second Corps, which was under the command of Heth's West Point classmate and groomsman, A. P. Hill. After Hill was wounded during the night of May 2–3 at Chancellorsville, Heth took command of Hill's division and led it with characteristic aggressiveness through the rest of the battle. Despite suffering a slight wound of his own at Chancellorsville, Heth received command of a new division in the Third Corps shortly before the Confederate army embarked on a second campaign north of the Potomac River in June 1863.

On June 30, 1863, Heth, now a major general, sent a force into the small Pennsylvania town of Gettysburg in order, he wrote a few months later, to "search the town for army supplies (shoes especially)." After briefly skirmishing with Union cavalry, Heth returned to the town the following morning, July 1. His advance once again encountered cavalry, almost by accident touching off the Battle of Gettysburg. Heth handled his division badly that day and suffered a head wound. Command transferred to Brigadier General James J. Pettigrew, and on July 3 the division participated in the attack on Cemetery Ridge that came to be known as Pickett's Charge. Heth recovered sufficiently from his wound, however, to resume his command even before the army retreated across the Potomac and back to Virginia.

Heth played his part in the debacle that was the Bristoe Station Campaign of October 1863, which earned Hill a stern rebuke from Lee. But Heth was effective through the Overland Campaign of 1864 . He also fought well at Weldon Railroad, Reams's Station, Peebles's Farm, and Burgess's Mill during the siege of Petersburg (1864–1865), with Lee and Hill repeatedly turning to his command to defend the logistical lifelines that sustained the army against an inexorable Union campaign to seize them.

When Hill was killed during the last Union offensive against Petersburg on April 2, 1865, Lee intended to have Heth take command of the Third Corps. But in the course of the day's fighting, Heth had become physically separated from the rest of the corps, which led Lee to assign direction of the corps to another officer. Heth nonetheless managed to accompany the army as it retreated west from Petersburg and was with it when it surrendered at Appomattox Court House on April 9, 1865.