The Talmud states that Elimelech, Machlon, and Kilyon were among the great men of their generation who died prematurely as a divine punishment for abandoning Eretz Yisrael in a time of famine, and for the sin of permitting the Moabite marriages. The Gemara links their deaths to these transgressions.
וְכֵן הָיָה רַבִּי שִׁמְעוֹן בֶּן יוֹחַאי אוֹמֵר: אֱלִימֶלֶךְ, מַחְלוֹן וְכִלְיוֹן, גְּדוֹלֵי הַדּוֹר הָיוּ, וּפַרְנְסֵי הַדּוֹר הָיוּ; וּמִפְּנֵי מָה נֶעְנְשׁוּ? מִפְּנֵי שֶׁיָּצְאוּ מֵאָרֶץ לְחוּצָה לָאָרֶץ, שֶׁנֶּאֱמַר: ״וַתֵּהֹם כׇּל הָעִיר עֲלֵיהֶן, וַתֹּאמַרְנָה הֲזֹאת נׇעֳמִי״. מַאי ״הֲזֹאת נָעֳמִי״? אָמַר רַבִּי יִצְחָק, אָמְרוּ: חֲזִיתֶם נָעֳמִי שֶׁיָּצָאת מֵאָרֶץ לְחוּץ לָאָרֶץ – מָה עָלְתָה לָהּ? (סִימָן: מָלַךְ, אַבְרָהָם, עֶשֶׂר שָׁנִים, שֶׁנִּפְטַר, נִתְנַשֵּׂא לְבַדּוֹ.) אָמַר רַב חָנָן בַּר רָבָא אָמַר רַב: אֱלִימֶלֶךְ, וְשַׂלְמוֹן, וּפְלוֹנִי אַלְמוֹנִי, וַאֲבִי נָעֳמִי – כּוּלָּן בְּנֵי נַחְשׁוֹן בֶּן עַמִּינָדָב הֵן. מַאי קָא מַשְׁמַע לַן? שֶׁאֲפִילּוּ מִי שֶׁיֵּשׁ לוֹ זְכוּת אָבוֹת, אֵינָהּ עוֹמֶדֶת לוֹ בְּשָׁעָה שֶׁיּוֹצֵא מֵאָרֶץ לְחוּצָה לָאָרֶץ.
And Rabbi Shimon ben Yoḥai would likewise say: Elimelech and his sons Mahlon and Chilion were prominent members of their generation and were leaders of their generation. And for what reason were they punished? They were punished because they left Eretz Yisrael to go outside of Eretz Yisrael, as it is stated concerning Naomi and Ruth: “And all the city was astir concerning them, and the women said: Is this Naomi?” (Ruth 1:19). The Gemara asks: What is the meaning of the phrase: “Is this Naomi”? How does this indicate that her husband and sons were punished for leaving Eretz Yisrael? Rabbi Yitzḥak says that the women said: Have you seen what befell Naomi, who left Eretz Yisrael for outside of Eretz Yisrael? Not only did she not escape tribulations there, but she lost her status entirely. The Gemara provides a mnemonic for the ensuing statements that Rav Ḥanan bar Rava said that Rav said: Melech; Abraham; ten years; when he died; and He alone was exalted. Rav Ḥanan bar Rava says that Rav says: With regard to Elimelech, and Boaz’s father, Salmon, and So-and-so, the unnamed relative who was a closer relative to Elimelech than Boaz (Ruth 4:1), and Naomi’s father, all of these are descendants of Nahshon, son of Amminadab, the head of the tribe of Judah (see Ruth 4:20–21 and Numbers 2:3). The Gemara asks: What is he teaching us by this statement? He is teaching that even in the case of one who has the merit of his ancestors to protect him, this merit does not stand for him when he leaves Eretz Yisrael to go outside of Eretz Yisrael, as Elimelech died on account of this sin.