In general when stocks fall, the dollar gains on the higher yielders as it falls against the yen. (The higher-yielding currencies are the euro, pound Australian and New Zealand dollars). The exact opposite tends to occur when stocks rise-the dollar will weaken against the higher yielders as it gains on the yen.
Much of this movement has been attributed to what's known as the carry trade; when stocks rise and risk-acceptance is in the air, traders borrow the low-cost yen in order to fund investments in higher yielding instruments denominated in euros, pounds, etc. Those loans must be paid back when traders sell positions.
The carry trade isn't the only driver of currency prices but it's a major one. Interest rates, or rather, the direction traders believe central banks will move interest rates, also are a major influence on price.
For example, the Fed began cutting interest rates back in September 2007. The euro appreciated sharply and oil rose. Stocks basically treaded water, although they peaked in October of that year. The pound traded flat that Fall.
The euro, which was being accepted more and more as payment for oil, continued to rise during the winter of 2008 as the Fed reduced interest rates further. Oil was on the way to $147 per barrel. The pound declined during this period.
But all heck broke loose after Lehman brothers collapsed in September. Stocks began their steep plunge and as serious risk aversion took hold of the markets the dollar made dramatic gains against the euro (and the other higher-yielders), helped in part by the steep drop in oil. The pound declined sharply.
Meanwhile, the yen was on its way from 110 to 86 as carry trades unwound. The Japanese currency appreciated sharply against all the higher-yielders, including a fall from about 250 to a low of about 118 on GBP/JPY, a fall of about 13,000 pips!
Other factors can come into play as well, which brings us to the curious case of the falling yen. Its recent fall, coming as stocks made new bear-market lows, occurred as ASEAN nations established a $120 billion fund to support their currencies which they did so primarily by purchasing against the yen, weakening it in the process.
Countries such as Malaysia and the Philippines borrow in foreign currencies; when a crisis hits and their currencies fall, it becomes all the more expensive to pay back the loans. Because many of these nations run current account surpluses (as a result of their exports to Western economies), it was easier for them to support their currencies now than it was during the Asian crisis in 1997, when most Asian economies ran current account deficits. Japan, which borrows in its own currency (which it can do because it's the world's second-largest economy), is helped when the yen falls (to say nothing of its export sector).