Gardner was called up in August 1939, shortly after the Second World War broke out, and served as anti-submarine officer on the Royal Navy destroyer HMS Broke. His ship escorted convoys in the Atlantic and Arctic Oceans, and was then posted to the Mediterranean to support the Operation Torch landings in North Africa. He joined Operation Terminal, the storming of Algiers harbour in November 1942. The destroyers HMS Broke and HMS Malcolm were tasked with securing the port facilities and power station at Algiers. Malcolm came under fire and was forced to withdraw with engine damage, but Broke rammed through a boom protecting the harbour and disembarked its shore party. Broke then also came under heavy fire from Vichy French forces and was forced to withdraw. Broke sank the next day while heading for Gibraltar. Her crew, including Gardner, were rescued by the destroyer HMS Zetland and returned to Algiers, now captured by the Allies, before returning to England on a Dutch liner. The convoy was attacked by a submarine: the escort carrier immediately ahead,, was torpedoed and sank. Gardner had been injured in Algiers, and was rendered deaf in one ear. He was later mentioned in dispatches for his actions. He joined the destroyer HMS Highlander in 1943, serving again in the Atlantic, but his deafness then forced him to serve on land rather than at sea. He was promoted to lieutenant commander and served on the staff of Admiral Sir Max Horton, commander of the Western Approaches based in Liverpool. By the end of the war, he was an acting commander, serving as Assistant Chief Staff Officer Ceylon, based in Colombo. He was demobilised in 1946. He was awarded the Volunteer Reserve Decoration.
Post-war career
Gardner joined the Colonial Serviceafter the war, serving in Kenya from 1951. He met his wife, Mary, at a dance in Mombasa. He then worked as an engineer in west Kenya, living in Kisumu beside Lake Victoria, before moving to Nakuru, where he painted oils, watercolours and pastels of local scenes, such as flamingos on a nearby soda lake. He caught tick typhus, and became deaf in both ears. He returned to England with his family in 1963, and retired to Dorset. He turned to painting maritime subjects. His detailed paintings found a ready market, and he held several exhibitions in London. He is best known for his paintings of warships from the Napoleonic Wars, and paintings of clippers from later in the 19th century. An exhibition of his work at Messum's gallery in Mayfair in October 2005, the bicentenary of the Battle of Trafalgar, included paintings of every ship in which Nelson had served. A book of the paintings, Nelson's Ships: A Trafalgar Tribute. He was a Fellow of the Institution of Civil Engineers, and also a member of the Royal Society of Marine Artists. He was survived by his wife, and their son and daughter.