Allah reminds us many times in the Qur'an against the perils of being arrogant with our wealth and our achievements, and so the theme of this story is a familiar one.
It is agreed that this story took place in Saba (present day Yemen), which, generations before, during the time of Nabi Sulaiman AS, was ruled by queen Bilqis. Saba used to be a parched and barren desert, until one of the kings of Saba commissioned the construction of a dam to irrigate the dry land. It is widely believed that this is the dam of Ma'rib, which was built between two mountains to control the flow of water for the land. Ruins of the dam still remain in present day Yemen up to this day.
"Indeed there was for Saba' (Sheba) a sign in their dwelling-place - two gardens on the right hand and on the left; (and it was said to them:) "Eat of the provision of your Lord, and be grateful to Him.' A fair land and an Oft-Forgiving Lord!" (Saba, verse 15)
Saba then transformed into a fertile land, and the people at the beginning were righteous and lived in accordance with the rules of Allah. The people lived a life of ease and comfort, with fruits and sustenance available to them in abundance, and with minimal labour on their part. Qatada (RA) and others said: "the woman (from among them) would go putting a basket on her head, and it would be filled with fresh, ripe fruits, and they said that the air they breathed was so clean and pure that neither flies, nor harmful germs were found in their land." Such purity of surroundings and abundance of provision is unimaginable in any other part of the world!
Allah also made their travel easy, and the stages of the journeys that people of Saba had to undertake were spaced out in such a way that they could travel safely during the night and day. And We placed between them and the cities which We had blessed [many] visible cities. "And We determined between them the [distances of] journey, [saying], "Travel between them by night or day in safety."" (Saba verse 34:18)
However as time passed, the people of Saba turned away from the obedience of Allah. They became conceited with their wealth, and took these blessings for granted. They were ungrateful for their easy lives and started complaining. They asked for the stages of their journey to be made longer and more challenging: But they said: "Our Lord! Make the stages between our journey longer," and they wronged themselves..." (Saba verse 34:19)
It is a sunnah (precedent) of Allah that He will increase to those who give Him thanks for the blessings bestowed upon them. The people of Saba ceased to be grateful to Allah, and their ongoing ingratitude deprived themselves of Allah's great blessings and grace. Like the majority of those on whom Allah had bestowed His provision and abundance, the people of Saba assumed that their wealth was eternal, and had no inkling of the punishment to come. Their ingratitude led to them being disobedient disbelievers to Allah.
Many scholars said that Allah sent mice or rats to gnaw through the base of the dam. When this was discovered, the people of Saba brought cats to control the rodent infestation, but their efforts were in vain. It is said that some noblemen of Saba who were aware of the impending destruction of the dam and found ways to flee the country with their treasures, by employing various tricks to deceive the rest of the people on their real reason for leaving. These people eventually met a turbulent end due to fighting and wars and had to disperse throughout the land.