From 100 Decisive Battles:

"When Okinawa was finally declared secure, the cost had been horrific. Some 150,000 Okinawans died, approximately one-third the island's population. An additional 10,000 Koreans, used by the Japanese military as slave labor, died as well. Of the 119,000 or so Japanese soldiers, as many as 112,000 were killed in the battle or forever sealed inside a collapsed cave or bunker. Aside from the human cost, most of the physical aspects of Okinawan culture were razed. Few buildings survived the 3 months fighting. Collectively, the defenders lost more dead than the Japanese suffered in the two atomic bombings combined. The United States lost 13,000 dead: almost 8,000 on the island and the remainder at sea; another 32,000 were wounded.

The loss of life on both sides, particularly among the Japanese civilians, caused immense worry in Washington. New President Harry Truman was looking at the plans for a proposed assault on the Japanese main islands, and the casualty projections were unacceptable. Projections numbered the potential casualties from 100,000 in the first 30 days to as many as 1 million attackers, and the death count for the Japanese civilians would be impossible to calculate. If they resisted as strongly as did the citizens of Okinawa -- and the inhabitants of the home islands would be even more dedicated to defending their homeland -- Japan would become a wasteland. It was already looking like one in many areas. The U.S. bombing campaign, in place since the previous September, was burning out huge areas of Japanese cities. How much longer the Japanese could have held out in the face of the fire bombing is a matter of much dispute; some project that, had the incendiary raids continued until November, the Japanese would have been thrown back to an almost Stone Age existence. The problem was this: no one in the west knew exactly what was happening in Japan. The devastation could be estimated, but the resistance could not.

Thus, with the casualties of the Okinawa battle fresh in his mind, when Truman learned of the successful testing of an atomic bomb, he ordered its use. This is a decision debated since 6 August 1945, the date of the bombing of Hiroshima, and even before. Just what was known of Japanese decision-making processes before that date is also argued to this day. Was the Japanese government in the process of formulating a peace offer, in spite of the demand for unconditional surrender the Allies had decided upon in February 1943? If they were doing so, did anyone in the west know about it? Who knew what, when they knew it, and what effect that knowledge had or may have had on Truman's decision making is a matter of much dispute. Whatever the political ramifications of the atomic bomb on the immediate and postwar world, Truman's decision was certainly based in no small part on the nature of the fighting on Okinawa. Truman wrote just after his decision, "We'll end the war sooner now. And think of the kids who wont be killed."

Note that a persuasive counter-argument was posted by Floegipoky (https://news.ycombinator.com/item?id=11751090)

"The invasion of Okinawa is not at all comparable to a potential invasion of Japan. I won't address your main point. I'm posting to correct a grave misunderstanding about the relationship between Okinawa and Japan during this period. Okinawa is a distinct cultural entity, and the island was viewed by Japan as occupied territory. Japanese forces slaughtered Okinawans, going so far as to use them as human shields. Some Okinawans were ordered to kill themselves and their families to avoid the horrific fate that the Japanese promised at the hands of American troops. Others, including schoolchildren, were pressed into front-line service or sent on suicide missions. Others were simply murdered, whether for their food or supplies, out of paranoia to root out "spies" (those who made the grave mistake of speaking in Okinawan within earshot), or for entertainment. I'm not saying Americans didn't kill Okinawans too. What I'm saying is that the Japanese could not have cared less about the survival of Okinawa: the land, culture, or people.

While the Japanese were certainly willing to use civilians for tactical or strategic gain, one cannot assume that their military forces would have raped and pillaged their own populace in the same manner.

https://en.wikipedia.org/wiki/Battle_of_Okinawa#Civilian_los... "

Nonetheless, you can see how a reasonable person could take the stance that developing the bomb was ethical. Being compared to mass murderers and such is just breathless posturing.