Following the outbreak of the First World War, Cunningham volunteered for the New Zealand Expeditionary Force (NZEF), which was being raised for service overseas. An experienced soldier in the Territorial Force, he was assigned to the Wellington Battalion with the rank of major. He served during the Gallipoli Campaign and on 8 August 1915, when the battalion commander, Lieutenant Colonel William George Malone, was killed during the Battle of Chunuk Bair, Cunningham briefly took command before he was wounded. Evacuated to England for medical treatment, he was mentioned in despatches for his services while at Gallipoli.