Enlisting in the Confederate Army in April 1861, Kennedy became captain of Company E, 2nd South Carolina Infantry Regiment, under fellow Camden resident Col. Joseph Brevard Kershaw. At the First Battle of Manassas, he was struck by a Minie ball and badly wounded. Recovering, he was promoted to colonel when Kershaw was promoted to brigadier general. Kennedy's first action in command of a regiment occurred at a skirmish on the Nine-Mile Road near Richmond, Virginia, in June 1862 during the Peninsula Campaign. After fighting at the Battle of Savage's Station, he was disabled for several weeks by fever. He returned to his regiment in time for the Maryland Campaign. During Stonewall Jackson's investment of Harpers Ferry, Kennedy was with Kershaw's brigade in the capture of the important Maryland Heights. He led his regiment in Kershaw's counterattack during the Battle of Antietam, driving a part of the UnionII Corps before him. However, he fell painfully wounded in the first charge, struck in the instep and Achilles tendon while crossing a wooden fence along the Hagerstown Pike. Once again recovering in time for a major battle, Kennedy led the 2nd and 8th South Carolina to the support of Gen. Howell Cobb at Marye's Heights, the focus of the hottest fighting at Fredericksburg. In 1863, Kennedy efficiently led his regiment during the battles of Chancellorsville and Gettysburg. During 1864, when not disabled, he was either in command of his regiment or of Kershaw's old brigade during the Richmond and Shenandoah Valley campaigns. In December he was promoted to the temporary rank of brigadier general; and continued to command the brigade when it was transferred down south. He took part in the Carolinas Campaign against William T. Sherman, including the Battle of Bentonville, and surrendered with Johnston's army at Greensboro. Kennedy survived six wounds during his service to the Confederacy, and was hit fifteen times by spent balls.
Postbellum activities
After the close of hostilities, Kennedy was mainly engaged in planting until 1877, when he finally established a law practice. He was an active member of the Kershaw Lodge #29 of the Freemasons in Camden. Elected to Congress in 1865, Kennedy declined to take the "ironclad" oath of allegiance demanded and did not take his seat. After his first wife died in 1876, Kennedy married Harriet A. Boykin and had an additional child. In 1878–79, he represented Kershaw County in the state legislature. He was elected Lieutenant Governor of South Carolina in 1880 and served until 1882 under Governor Johnson Hagood when he unsuccessfully ran for Governor. Kennedy became Grand Master of South Carolina Masons in 1881–83. In 1884, he was a presidential elector-at-large on the Democratic ticket. In 1886, President Grover Cleveland appointed him as United States Consul General in Shanghai, China. Returning from that post in 1889, Kennedy continued the practice of law at Camden until his death from a stroke. He was buried in Camden's Quaker Cemetery. A United Daughters of the Confederacy chapter was named for him. In 1911, Camden officials erected the Confederate Memorial Fountain, a six-sided structure with tablets on each column commemorating Kennedy and five other generals born in Kershaw County.