Why were the people of Ninveh in the Book of Jonah given the opportunity to do Tshuva (repent) while the people of Sdom were not?
The Gemara in Sanhedrin 109b discusses the sins of the people of Sdom:
They had beds on which they would lay their guests; when a guest was longer than the bed they would cut him, and when a guest was shorter than the bed, they would stretch him. Eliezer, Avraham’s servant, happened to come there. They said to him: Come lie on the bed. He said to them: I took a vow that since the day my mother died, I do not lie on a bed.
There was a young woman who would secretly take bread out to the poor in a pitcher. When her act of kindness was discovered, she was smeared with honey, and the hornets came and consumed her. That is the meaning of that which is written (Breisheet 18:20): “And the Lord said: The outcry of Sdom and Amora is great (raba) and their sin is very great.” Rav Yehuda teaches the words of Rav: The word “raba” is an allusion to the young woman (riva) who was killed for her act of kindness. Because of that sin, the fate of the people of Sdom was sealed.
Nechama Leibowitz points out that wickedness was the law of the land in Sdom and whoever violated the law and performed a good deed was condemned to be burnt at the stake. The only remedy for such a society was total destruction.
There was no room for Tshuva for the people of Sdom since they made their own cruel laws. They didn’t acknowledge the proper way to behave so there wasn’t an opportunity to return.
Ibn Ezra (Yona 1:2) explains that the difference between Sdom and Ninveh is that Ninveh had been historically considered a righteous city before it degenerated into corruption as it says (Jonah 3:3) “It was a great city belonging to God.” Since Ninveh had a foundation of goodness since the inhabitants had feared God in ancient times, God sent the prophet Jonah to prompt them to return and they repented with a full conscience. Sdom, by contrast, was established from its inception on a foundation of pure selfishness and wickedness, meaning there was no “original good state” for them to return to.
The fact that fewer than ten righteous people were found in Sdom proved that Sdom’s corruption was 100% absolute. There was no healthy spiritual nucleus left in Sdom capable of starting a repentance movement. Therefore, only Lot and a small portion of his family that were willing to go were saved.
The Rambam, in Hilchot Tshuva (Laws of Repentance) 3:2 writes that a country whose sins are great will immediately be obliterated as in says in Breisheet 18:20: “The outcry of Sdom and Amora is great.”
We learn from the story of Ninveh that if a society agrees to follow an ethical code then they have a path open for Tshuva, while we gather from the account of Sdom that if the population does not acknowledge basic moral behaviour and rules then they have no chance.

