I know what I'm about to answer won't be emotionally satisfying to a lot of people (including believers). Especially for those who deny that God kills (in spite of what they read in their Bibles about the firstborn in Egypt, and Sodom and Gomorra). Everyone was indiscriminately destroyed...same thing with the Flood of Noah. It's not just Old Testament either...Revelations tells us that God will pass judgement on the world once again.
The question is, really, what gives God the right? And the answer is, since He gave it, He can take it away. That just goes with the territory of being God. He created it all, it all belongs to Him. He needs no further justification because He is not compelled by any law higher than Himself. It's his prerogative to take life, and it's also his prerogative the manner in which He takes it.
But, what about innocents and women and children? Them too...and this really appeals to me on an emotional level, but I find another aspect to keep in mind. God not only deals with people as individuals, but as groups. When the nation of Israel is doing well as a nation (in His eyes...right by God, if you will), He prospers the whole nation. On the flip side, if the nation is corrupt, then God judges the whole nation. This isn't foreign to us as Americans, as we watch our President wage a war in Iraq...the President and Congress made the decision, but the people are the ones at war. My point is, we are all suffering alike in the process.
But ultimately, as B2B is asking, the question is "If God were really good, how could He do such things?" And what you're looking at is all the death and destruction you see that God can do. But, looking at the same record (Old and New Testaments), you'll find that God IS good. He continually demonstrates not just his goodness, but his patience and forbearance for those that consistently rebel against Him, even though he's cared for them.
When we were kids, we learned that our parents acted in ways we didn't understand. We didn't think their decisions were fair. But later in life, we learned that our parents had insight and information unavailable to us that influenced their decisions. Eventually we figured out (for the most part) that Mom and Dad were acting in our best interests, even though we didn't see it at the time. So, the possibility exists that maybe God just knows a few more things than we do.
Even if none of that "learning as we grow" mumbo jumbo doesn't work for you...He is still the creator of life, and He still has the right to take life according to His own judgement.