President Franklin Roosevelt's New Deal was already having a positive effect on some of the worst aspects of The Great Depression, but it was America's entrance into World War II that made the Depression officially end. The answer as to how is twofold.
First, the European nations that went to war needed goods (Jeeps, tanks, airplanes, parachutes, ammunition, medical equipment, etc.) to supply their militaries. American factories and manufacturing kicked into high gear to supply these products and more to our allies, like Britain. This proved to be a great boost to the United States economy and created millions of new jobs, thus growing the gross domestic product and providing the federal government with more tax revenue. The companies that manufactured wartime goods also created millions of new jobs, thus easing the unemployment problem.
But second, when Japan attacked Pearl Harbor and the United States suddenly found itself fighting in the war, over ten million Americans went into the military (in either active combat or support roles). Obviously, many of these people left jobs to do so, and this put an almost immediate end to the unemployment crisis caused by The Great Depression because businesses of all sizes suddenly had job openings galore, and a huge demand to fill them.