At the outbreak of the Second World War, Whiteley volunteered for the Royal Air Force. However, they rejected him citing his poor eyesight. He then applied to the Royal Marines, who did accept him, and he began his officer training. He was commissioned as a probationary second lieutenant on 1 January 1940. On 20 March 1942, his commission was confirmed and he was given the rank of lieutenant with seniority from 14 June 1941. During the war, he served aboard , a battleship, and aboard , a light cruiser. During the latter part of the war, he served with the British Pacific Fleet which was fighting against the Japanese. He could claim to have fired some of the last shots of the war: on 15 August 1945, during an attack by a Japanese aircraft on his ship, he was attempting to shoot it down when the news of the ceasefire with Japan was received.