I'm afraid that I must disagree with @Samuel Russell. Yes, war spending is a case of the broken window fallacy, and I'm inclined to believe that Bastiat is both clearer and more correct than Mr. Russell gives credit. I suspect that I'd like to sit down with Mr. Russell and puzzle out our disagreement over beer, but this is not the place for that discussion.
The Parable of the Broken Window states that not all spending is equally valuable to the economy. Spending that preserves the status quo (repairs to a broken window) or which is externally mandated (war spending), is less valuable than truly voluntary or discretionary spending, because truly voluntary spending transmits signals about the wants and desires of the consumer. Spending to preserve the status quo does not generate as much growth or innovation. (reductio ad absurdium, if all spending is directed to preserving the status quo, you can never ever create apple computer by spending on broken windows. New products require spending that is not restricted to preserving the status quo, and is not regulatory.)
The depression was not a broken window problem. The depression arose (again, grossly oversimplifying) because the economy was performing FAR under anyone's estimate of what was optimal. Consumer demand was low, which resulted in low production, which resulted in layoffs, which resulted in reduced consumer demand in a horrible spiral. If you want to force fit the broken window into the situation, the depression was because people chose not to replace the window, but just to close the shop.
In such a situation, government spending increases production, increased production increases hiring, increased hiring leads to increased demand. I believe the point that Mr. Russell makes well is that the war spending/government spending/mandatory spending is not tied to utility the same way that consumer demand is. For the duraqtion of the war, consumer spending is actually suppressed because of the proportion of production that is diverted from products with intrinsic utility (consumer demand, or "butter") to production of goods where the utility is externally mandated (Military production or "guns"). The surge in demand nevertheless causes a surge in production, which causes hiring, which raises wages, which reverses the downward spiral that transformed a recession into a depression.
This is a book length question - multiple books have been written about it. Many of them disagree, some with great vehemence. I've tried to limit this answer to be extremely brief, and to avoid some of the more controversial assertions. I've probably fallen short of the goal, but I hope I haven't stepped on too many toes.