During the American Civil War, as a member of the "Baltimore County Horse Guards" under Captain Charles Carnan Ridgely, Jr.'s (of Hampton Mansion, near Towsontown), Gilmor was arrested and imprisoned in Fort McHenry following the "Pratt Street Riots" of April 19th, 1861, with the subsequent occupation of Baltimore and Fort Federal Hill by Federal troops under Gen. Benjamin F. Butler of the 6th &amp; 8th Massachusetts state militia in May 1861. Upon his release, he traveled South and eventually rejoined the fighting serving, for a while, under General Turner Ashby. He was again captured during the Maryland Campaign and spent five months in prison. During the Gettysburg Campaign of June–July, 1863, Major Gilmor was assigned command of the First Maryland Cavalry and Second Maryland Cavalry, supporting Brig. Gen. George Steuart's infantry brigade. Gilmor was the provost marshal of the town of Gettysburg while it was occupied by the Confederates July 1–4.