Formed during World War I at Gosport on 1 March 1916 as Number 45 Squadron, the unit was first equipped with Sopwith 1½ Strutters which it was to fly in the Scout role. Deployed to France in October of that year, the Squadron found itself suffering heavy losses due to the quality of its aircraft. This did not change until it transitioned to the Sopwith Camel in mid-1917. Transferred to the Austro-Italian front at the end of 1917, 45 Squadron there engaged in ground attack and offensive patrols until September 1918 when it returned to France. Assigned to the Independent Air Force, 45 Squadron provided long-range bomber escort till the end of the war.
During the course of the war, some thirty flying aces had served in the squadron's ranks. They included future Air Vice-Marshal Matthew Frew, Cedric Howell, Geoffrey Hornblower Cock, future Air Commodore Raymond Brownell, John C. B. Firth, Kenneth Barbour Montgomery, Mansell Richard James, Norman Macmillan, Peter Carpenter, Richard Jeffries Dawes, Norman Cyril Jones, Ernest Masters, Henry Moody, Thomas F. Williams, William Wright, James Dewhirst, James Belgrave, Edward Clarke, Alfred Haines, Thomas M. Harries, Alan Rice-Oxley, Earl Hand, Sir Arthur Harris, 1st Baronet, Charles Gray Catto, John Pinder, and future Group Captain Sidney Cottle.
In 1919 the Squadron returned to England and disbanded. In April 1921 it reformed at Helwan, Egypt. Assigned Vickers Vernon bomber-transports, the unit provided troop transportation and ground support and mail services throughout the Middle East, notably in support of anti-rebel operations in Iraq and the Palestine. During the mid-war years the unit transitioned to DH9As (1927) and Fairey IIIs (1929) and then a combination of Hawker Harts, Vickers Vincents and Fairey Gordons (1935).
At some point the unit adopted the nickname "The Flying Camels". The Squadron Badge is a winged camel, approved by King Edward VIII in October 1936. The badge and nickname derive from the Sopwith used by the unit in World War I and its long service in the Middle East.
At the start of World War II, 45 Squadron converted to Bristol Blenheims. From mid-1940 it took part in the North African Campaign and on 11 June, was one of three squadrons that participated in the Allies' first attack on the Regia Aeronautica (Italian air force) base at El Adem: 18 Italian aircraft were destroyed or damaged on the ground, for the loss of three British aircraft. The following day, the squadron participated in an attack on shipping at Tobruk, damaging the Italian cruiser San Giorgio.