They'll just nationalize the factories.
Not just existing military factories - civilian infrastructure will be converted where possible. E.g. a car factory changes to making military vehicles.
If necessary, guys with guns will arrive to ensure that production continues.
Lots of historical references on this sort of thing from the WW2 era.