Many of the major indices retreated
today because of this news. Why? How
do the rising budget deficits and debt
relate to the stock markets?
The major reason for the market retreating is the uncertainty regarding the US Dollar. If the US credit rating drops that will have an inflationary effect on the currency (as it will push up the cost of US Treasuries and reduce confidence in the USD). If this continues the loss of USD confidence could bring an end to the USD as the world's reserve currency which could also create inflation (as world banks could reduce their USD reserves).
This can make US assets appear overvalued.
Why is there such a large emphasis on
the S&P rating?
S&P is a large trusted rating agency so the market will respond to their analysis much like how a bank would respond to any change in your rating by Transunion (Consumer Credit Bureau)
Does this have any major implications
for the US stock markets today, in the
short term and in July?
If you are a day-trader I'm sure it does. There will be minor fluctuations in the market as soon as news comes out (either of its extension or any expected delays in passing that extension).
What happens when the debt ceiling is
Since the US is in a deficit spending situation it needs to borrow more to satisfy its existing obligations (in short it pays its debt with more debt). As a result, if the debt ceiling isn't raised then eventually the US will be unable to pay its existing obligations. We would be in a default situation which could have devastating affects on the value of the USD.
How hard the hit will depend on how long the default situation lasts (the longer we go without an increased ceiling after the exhaustion point the more we default on).
In reality, Congress will approve a raise, but they will drag it out to the last possible minute. They want to appear as if they are against it, but they understand the catastrophic effects of not doing so.