As individuals, intelligent life needs goals to move forward; as collectives, nations and organizations need goals that can guide and unite everyone to advance together. And the most quickly and easily accepted goal for everyone, of course, is an enemy.
A powerful external enemy can unite all social strata and can also be used to suppress all voices of dissatisfaction with the leadership. Large-scale conscription and the drafting of various logistics personnel can send a large number of unemployed into the military and the military-industrial complex. War-time supply control can enable the government to strengthen its control over all aspects, while also allowing the government to arbitrarily set various policies under the guise of "wartime," such as fully launching a planned economy model to control the production of goods, or persecuting minorities with trumped-up charges of "colluding with the enemy" to please the majority and endorse government policies.