After the Civil War started, Haller commanded George B. McClellan's headquarters guard during the Peninsula Campaign and again in the Maryland Campaign. In May 1863, he returned to his native York to recover from illness contracted in the field. In June, Maj. Gen. Darius N. Couch appointed Haller to command the defenses of Adams and York counties in south-central Pennsylvania. During the Gettysburg Campaign, Haller retreated from Gettysburg to Wrightsville, Pennsylvania, where his militia and that of Col. Jacob G. Frick burned the Columbia-Wrightsville Bridge to prevent passage over the Susquehanna River by a Confederate brigade under John B. Gordon.