According to Dave, until you have all your debt paid off, you shouldn’t be saving for retirement. But this ignores the value that compounding interest brings over time.
Actually, the math does not necessarily favor investing over paying off debt. A number I pulled from Vanguard shows a 10.37% compounded annual return without adjusting for inflation over the period from 1926-2005. After adjusting for inflation the return is 7.29%. Obviously, the interest rate on your debt will make a difference, but consider some current national average loan rates:
Auto: 6.72% (rate for new, 36-month note)
7.17% (rate for used, 36-month note)
Credit: 11.34% (low-interest card average rate)
Mortgage: 5.50% (30-year fixed)
Home Equity: 8.49% (30K note)
Only the mortgage provides a less favorable rate of return than investing in equities, and that assumes you have the favorable rate listed above. Even after you calculate the interest rate reduction on federal taxes, your effective rate will be 4.125% if you are in the 25% marginal bracket. While this may appear logical on the surface, you must also consider risk. You get a 'guaranteed' rate of return by paying off your mortgage of 4.125%. However, to get the average return of 7.29% in the market, you must take on equity risk. I believe the risk-adjusted return in this scenario actually favors paying off the mortgage versus investing.
Perhaps the one caveat in this math is if you are employed and receive a 401(k) match from your employer. This would boost the effective return on your investment for the portion that is matched. Therefore, the math may favor investing up to the match level in that situation.
Finally, as has been pointed out by many others, much of this is psychological and about changing your lifestyle. In other words, many people must make the move from living a "buy now, worry about paying later" lifestyle.