These were known as War Economies.
In order words countries during World War I and World War II were in a state of Total War
This means that the economic policies of these countries were designed to maximize production of weapons, artillery, and military supplies.
The aim was to mobilize all resources to ensure the defense or offense in a war situation.
For countries such as Germany and the United Kingdom, it was the only way to survive the wars, even though the long-term ramifications are more arguable.
However, after World War II ended, the old war economy had help push America to the number 1 spot in the world in terms of economic power.