During the Second World War, Foster served with the Fife and Forfar Yeomanry. He saw action at Dunkirk with the 8th Armoured Division, El Alamein with the 18th Army Group, Tripoli with the 21st Army Group, and finally in North-Western Europe. He achieved the rank of colonel, was appointed MBE in 1943, and was mentioned in despatches three times. He received the Territorial Decoration in 1946.