Commissioned and promoted second and first lieutenant in the 2nd U.S. Artillery on June 24, 1861, Hains briefly commanded Battery M, 2nd U.S. Artillery, in the U.S. Horse Artillery Brigade, until transferring to the Corps of Topographical Engineers on July 24, 1862. He won a brevet promotion to captain on May 22, 1862, for actions at Hanover Court House. Less than a year later, on March 3, 1863, Hains transferred again—this time into the Corps of Engineers.