During the American Civil War, Oakey served as a private with the 7th Regiment of the New York National Guard. He served for three months in 1861 at Washington D.C., another three months in 1862 at Federal Hill, Baltimore, and another three months in 1863 at Federal Hill, Frederick, and Monocacy. He was also with the regiment during the New York City draft riots. He was later promoted to judge advocate, with the rank of colonel, on the staff of Major-General Alexander Shaler of the First Division of the New York National Guard.