Shortly after the outbreak of the Second World War in 1939, the squadron moved to France as part of the British Expeditionary Force.
Following Germany's invasion of France and the Low Countries on 10 May 1940, 4 Squadron was frequently forced to change bases by the approach of the advancing German armies, being withdrawn to the UK on 24 May.
Losses had been heavy, with 18 aircrew killed, while 60% of the groundcrew were lost.
It continued in the coastal patrol and air-sea rescue role while training for its main army co-operation role after returning to the UK.
In 1942 the Squadron changed its mission from the traditional Army Co-operation role, where it would operate fairly low-performance aircraft from airstrips close to the front-line, to that of fighter-reconnaissance, receiving the more modern Curtiss Tomahawk and North American Mustang, soon settling on the Mustang, flying low-level attack and reconnaissance flights against targets on the continent.
In August 1943, it joined 2 Tactical Air Force in support of the planned invasion of Europe, changing to the pure reconnaissance mission in January, and replacing its Mustangs with Mosquito PR.XVI and Spitfire PR.XIs. It discarded its Mosquitoes in June, moving to France in August, and briefly supplementing its Spitfires with a few Hawker Typhoons for low-level reconnaissance. It retained its Spitfires at VE Day, moving to Celle in Germany to carry out survey operations in support of the British Army of Occupation until it was disbanded on 31 August 1945