The common justification that I have read is that the bombings shortened what would have otherwise been a protracted defeat, potentially saving many more lives than were taken. A Utilitarian argument. However, if we were to take a Kantian point of view, the bombed civilians were used as an “ends” to achieve victory. Or more simply, an immoral act can never be justified, whatever the outcome.
So which is right? I enjoyed a recent Star Trek episode that examined the Utilitarian philosophy taken to an extreme (spoilers follow). In it an advanced utopian society is powered by the suffering of one child, chosen before birth. The joy and happiness of millions, at the expense of one innocent. Utilitarian philosophy (and modern economic theory), would call this an obviously acceptable trade-off, but Kant would argue that it is immoral as a person can never be used as an ends.
In the real world, we saw this argument play out in regards to whether the torture of terrorists was acceptable if it meant the extraction of information that would save lives.
Personally, I am of the Kantian view point, and I think the nuclear bombing of the two Japanese cities can never, and should never, be justified as moral acts.