For the USA at least. The UK was a different issue, as they were actively being bombed and therefore experienced direct shortages.
The US and other countries also used synthetic Haber process ammonia to make nitric acid and explosives from it during World War II.
Here's a 1946 report about American chemical plants and facilities built to support the war effort:
https://catalog.hathitrust.org/Record/001108531
From pages 2 and 3 of the report:
The Government has invested more than $200 million in 10 synthetic ammonia plants, having a combined design capacity of about 800,000 tons of fixed nitrogen per year. These include eight ordnance plants, of which six have been declared surplus, one Defense Plant Corporation plant and one belonging to the Tennessee Valley Authority. Four plants have facilities for producing ammonium nitrate solutions. The nitric acid facilities located in the explosives plants of (2), and the ammonium nitrate graining facilities found in the ammunition loading plants of of (1) have a definite relationship to the ammonia plants.
https://www.theatlantic.com/health/archive/2014/04/reluctant...
Nitroglycerin was used as a component of smokeless powder -- propellant for bullets, mortar shells, and artillery.
The Haber-Bosch process was used by all belligerents in World War II. Germany was the only operator of the process during World War I, but it rapidly spread throughout the world between the wars.