Gilmour joined the Lovat Scouts in 1937 where he obtained his commission. He then joined the Seaforth Highlanders in 1939. Between 1942 and 1943, he was with the 2nd Seaforth in the 51st Highland Division of the 8th Army in the North Africa campaign. He was awarded the Military Cross at the Second Battle of El Alamein, with a Bar to the MC for further displays of courage in the face of the German Afrika Korps at the Battle of Wadi Akarit. He took part in the invasion of Sicily. He returned to the United Kingdom in 1943. From 1944, he served in Normandy, the Netherlands, and in Germany where he received the Distinguished Service Cross from the United States.