Well, they participated, just in a low-key, pro-Axis way under the cloak of neutrality, allowing German submarines to repair and refuel in Spanish ports, letting the Germans run a vast intelligence network in Spain, shipping huge quantities of wolfram to Germany, and dispatching a 45,000 man volunteer force to fight on the Eastern Front.
As for why they didn't directly participate, the Spanish Civil War had ended literally months before WWII broke out. Spain was a broken, devastated country and had little to offer Germany. Outright intervention on the Axis side wasn't totally out of the question, though. In October 1940, in his first and only meeting with Hitler, Franco laid out a series of conditions that Germany would have to meet for Spain to formally enter the war on her side, including some of France's North African colonies, arms shipments, and food supplies. Hitler couldn't meet the first condition without alienating his Vichy French clients. And he hardly made it easier for Franco to join in with his counter-demand for German bases in the Spanish Canaries, a non-starter for a Spanish nationalist like Franco. Franco was also skeptical that Britain could be forced out of the war anytime soon and probably worried that Spain's sparse remaining empire in North Africa would be overrun by the British in the event of their formal entry.
In the end, benevolent neutrality was probably the best Germany could hope for from Spain. The benefits they drew from their arrangement as described above all would have disappeared had Spain been an active belligerent. Spain as an ally would have been a liability for Germany and would have given them one more front to worry about in terms of an amphibious landing.
Sources:
Nemesis: Hitler 1936-1945 by Ian Kershaw
A World at Arms by Gerhard Weinberg