At the beginning of the Civil War, Getty was a captain in the 4th U.S. Artillery. In September, 1861, he was appointed lieutenant colonel. He commanded four batteries in Maj. Gen. George B. McClellan's 1862 Peninsula Campaign. Named Chief of Artillery of Maj. Gen. Ambrose Burnside's IX Corps, he served at the battles of South Mountain and Antietam during the Maryland Campaign. On September 25, 1862, Getty was promoted to the rank of brigadier general of volunteers and assigned to the infantry. During the Battle of Fredericksburg in December, he commanded the 3rd Division of IX Corps. In March, 1863, Getty's division was sent to Suffolk, Virginia, where the Federal Army under Maj. Gen. John A. Dix successfully resisted Lt. Gen. James Longstreet's investment of the town, which guarded the southern approaches to Norfolk and Hampton Roads. After subsequent engineering duty and command of a diversion to the South Anna River during the Gettysburg Campaign, Getty served as acting Inspector General of the Army of the Potomac in early 1864, He was assigned to command 2nd Division, VI Corps. He was wounded in the Battle of the Wilderness, but recovered to lead his troops during the lengthy Siege of Petersburg, and later in Maj. Gen. Philip Sheridan's Shenandoah Valley Campaign. Getty became acting commander of VI Corps when Brig. Gen. James B. Ricketts was wounded leading the corps at the Battle of Cedar Creek. On December 12, 1864, President Abraham Lincoln nominated Getty for appointment to the brevet grade of major general of volunteers, to rank from August 1, 1864, confirmed by the U.S. Senate on February 14, 1865. Getty's division, including the famed Vermont Brigade, made the initial breakthrough at Petersburg on April 2, 1865, and took part in the final campaign of the Army of the Potomac, which concluded with the surrender of Robert E. Lee at Appomattox Court House. On July 17, 1866, President Andrew Johnson nominated Getty for appointment to the brevet grade of major general, U.S. Army, to rank from March 13, 1865, which the U.S. Senate confirmed the appointment on July 23, 1866. Getty was mustered out of the volunteer force on October 9, 1866.
Postbellum career
Getty was in command of the District of Baltimore, Maryland., Aug. 9, 1865, to January, 29th, 1866. Then he was in command of the District of the Rio Grande, February 19 to August 31, 1866. During this time on July 28, 1866, Getty was appointed colonel of the 37th U.S. Infantry in the regular army. He next served in command of the District of Texas, from August 31 to October 9, 1866, during which time he was mustered out of Volunteer Service, on September 1, 1866. Following a leave of absence, awaiting orders, he was given command of the District of New Mexico, from April 11, 1867, to January 11, 1871. He transferred to command the 3rd U.S. Infantry, March 15, 1869. Getty then transferred to the 3rd U.S. Artillery on December 31, 1870, and then commanded the Artillery School at Fortress Monroe, Virginia, for six years. However, from June 24 to July 25, 1877, he was detached in command of troops along the Baltimore and Ohio Railroad during labor strikes. Getty was a member of the Board of Conduct which exonerated former V Corps commander Maj. Gen. Fitz John Porter in 1879. He transferred to the 4th U.S. Artillery on July 17, 1882. General Getty was a member of several military societies including the Aztec Club of 1847, the Military Order of the Loyal Legion of the United States and the Military Order of Foreign Wars. After he retired from the Army on October 2, 1883, Getty lived on a farm near Forest Glen, Maryland, until his death there on October 1, 1901. Getty was buried in Section 1 of Arlington National Cemetery. General Getty Neighborhood Park, located near his farm in Forest Glen, is named after him.