תִּשְׁקֹ֥ט הָאָ֖רֶץ אַרְבָּעִ֣ים שָׁנָ֑ה וַיָּ֖מׇת עׇתְנִיאֵ֥ל בֶּן־קְנַֽז׃ {פ}
And the land was quiet (from wars) for forty years. And ῾Otni᾽el the son of Kenaz died.
וַיֹּסִ֙פוּ֙ בְּנֵ֣י יִשְׂרָאֵ֔ל לַעֲשׂ֥וֹת הָרַ֖ע בְּעֵינֵ֣י ה' וַיְחַזֵּ֨ק ה' אֶת־עֶגְל֤וֹן מֶלֶךְ־מוֹאָב֙ עַל־יִשְׂרָאֵ֔ל עַ֛ל כִּי־עָשׂ֥וּ אֶת־הָרַ֖ע בְּעֵינֵ֥י ה'׃
And the children of Yisra᾽el continued to do what was evil in the eyes of Hashem: and Hashem strengthened ῾Eglon the king of Mo᾽av against Yisra᾽el, because they had done what was evil in the eyes of the Hashem.
As soon as Otnie ben Kenaz died the people began to go back to their evil ways. They became even worse than they had been before. That is why it says they "continued" (Vayosefu). Literally, it means "they added" - they added on to their earlier sins. Their guilt also became greater. Although G-d had saved them in spite of their earlier sins, these had been neither forgotten nor forgiven. They had never truly repented for the, and had turned to G-d only from necessity. Now they were again punished for the earlier sins as well.
Eglon, king of Moav was really a weak and Eglon was morbidly obese king, and the Jews should have been able to defeat him easily. But Hashem punished them by making him strong so that they would not be able to withstand him. When he began to have success against them, he called to the nations of Ammon and Amalek and said "Look, G-d has abandoned Israel. Come and join me. Now is our chance to defet them.
They were so confident that they could beat the Jews, now that G-d was not protecting them, that they did not even plan out a strategy. Nonetheless, they had immediate success, as it says, "they went and smote Israel."- They just went out to battle and won.
A note about Moav: Moab’s residents were descended from Lot, and the Torah commands the Israelites to neither attack nor absorb the Moabites. Notably, King David is descended from a Moabite, the convert Ruth. Moab was located in modern-day Jordan.
The Kli Yakar said: The kindness that Avraham did for Lot were both physical and spiritual, but Lot's descendants weren't grateful for any of them. They attacked & robbed them and left them so tired and downtrodden that they no longer had the strength to study the Torah and strive to serve Hashem.
And he gathered to him the children of ῾Ammon and ῾Amaleq, and went and smote Yisra᾽el, and they seized the city of palm trees.
Radak says, Their goal was to reconquer the land. They took the most fertile place, the area where Yericho had been. It was a great prize for them.
So the children of Yisra᾽el served ῾Eglon the king of Mo᾽av, for eighteen years.