Dead astronauts usually go hand-in-bodypart with a destroyed spacecraft. Said spacecraft is probably worth billions to build and more billions to maintain and actually use. Those 7 astronauts are probably not exactly cheap, either. There's usually decades of training and education involved for each one of them. I haven't even thought to add in the value of the shuttle's payload if it were lost in the same accident.
Now let's look at those soldiers dying by the tens of thousands in a foreign war. Each soldier is pretty cheap on an individual basis compared to an astronaut. Society hasn't invested that much time, resources, or education on the average soldier compared to an astronaut. Their future value to humanity is also statistically and economically lower than the astronaut. The equipment the average soldier goes to war with is only a few thousands - maybe few tens of thousands - of dollars. Said equipment is typically common stuff easily replaced, as is the solider lost with that equipment. Heck, you could easily give a dead soldier's equipment to a live soldier and save a few dollars.
So, dollar for dollar, you have to lose thousands of soldiers and their equipment to reach the same financial loss as the destruction of a shuttle and it's crew. Looking at the Iraq war, America has lost a paltry 4000+ soldiers spread out over a period of 6 years. Compare that to losing a shuttle, it's crew, and it's payload all in one fast blast, and it becomes easy to see why sending soldiers to die in war is so much easier than risking a shuttle mission to repair Hubble.
My point is more commentary on the state of human affairs; life is only important if there is a significant dollar value attached to it.
"I'm not a god, I was misquoted." -- Lister, Red Dwarf