On August 9, 1861, Martindale was commissioned a brigadier general of volunteers in the Union Army, and was assigned to command a brigade within the Union Army of the Potomac. He later participated in all the battles of the Peninsula Campaign in V Corps. After the retreat from Malvern Hill, he was brevetted a major general of volunteers, and appointed Military Governor of Washington, D.C., a post he held from November 1862 to May 1864. Afterward he returned to field service, fighting with the XVIII Corps in the Bermuda Hundred Campaign, the Battle of Cold Harbor and the Siege of Petersburg, commanding the corps briefly in mid-July 1864. In September 1864 he resigned his commission because of bad health.