War Production allows you to keep adding to your defensive forces while you're repelling an attack. This isn't an ability you'll have right away, and there are limitations as to what units can be produced, but once you've unlocked it, War Production is a great way to strengthen your base's defense. Once War Production is available, certain buildings in your base can be set to build units that will automatically deploy while you are under attack to reinforce your defense efforts.
TLDR version: It's really cool.
At this time, only the Barracks, War Factory, and Airfield are capable of War Production. They first acquire this ability at specific levels:
|Building||Gains War Production at level...|
When War Production is active in a building, that building will produce a new unit of a specific type every 20 seconds (infantry) or 30 seconds (vehicles and aircraft) while your base is under attack. If the building is destroyed during battle, it will cease War Production.
In this base, we can see from the unit icons floating over the Barracks and the War Factory that those buildings have War Production activated (the two arrows on the right).
The icons represent the unit types they'll produce while this base is under attack. The Airfield (the arrow on the left) hasn't had War production activated yet, so let's do it!
Click the Airfield and look for the War Production button.
Once you click the War Production button, you will see this screen, where you'll be able to select what unit type is going into War Production. We've decided we want to produce Sphinxes during battle, so we've clicked on the unit in the selection menu on the left (step 1), then to set production, we'll click on the Set Production Unit button (step 2).
Once we've done this, we'll see a unit icon floating over the Airfield, just like we see for the Barracks and the War Factory. Congratulations, commander--War Production is in full swing!
The number of unit types you have available for War Production will increase as you level up the building in question. Units spawned by War Production do not cost you anything to produce, and are spawned at whatever level you've upgraded that unit type to at the time of the attack. If you have not yet unlocked that unit type in your base but it is unlocked for War Production, it will spawn at level 1.
Units created by War Production vanish mysteriously after the end of battle. Perhaps, weary of war, they hang up their armor and retire to the hall of celebrated veterans. (In other words, no, you can't keep 'em.) When first spawned the units will aggressively attack the nearest enemy unit, but you are able to control them along with your other units.
If you decide you want to change the unit type you have selected for War Production, just repeat the steps for setting War Production until you see the current unit selected:
Then, click the unit type you want to produce instead (step 1). This will auto-fill the window showing what unit is to be produced. Once you're settled on your decision, hit the Set Production Unit button (step 2).