Joel promises restoration of “the years” that the great locust consumed. The loss is described in terms of multiple stages of destruction. See Joel 2:25.
In Joel 2:18–27, Yahweh responds with compassion to the crisis, turning from damage to renewal. He promises food staples again—grain, wine, and oil—so the people are satisfied and no longer mocked by other nations. He also promises the removal of the threatening “northern” force. This passage functions as Yahweh’s answer to the community’s earlier appeal for mercy and the concern that outsiders might scorn them (2:12–17). It shifts from commands to mourn and return, to direct divine speech promising reversal.
Joel 2:18–27 portrays a decisive reversal. The crisis that emptied fields and threatened public honor is met by Yahweh’s compassion: he “pities” his people and takes up the land as his own concern (verse 18). The restoration is concrete—grain, new wine, and oil return in abundance; rains come in season; threshing floors and vats refill (verses 19, 23–24).
A careful answer keeps the immediate passage, the book's argument, and the whole-Bible storyline together, so the question is answered in context instead of as a detached idea.
Start with Joel 2:25, then read the surrounding section so the answer stays connected to the passage's flow.
25I will restore to you the years that the swarming locust has eaten, The great locust, the grasshopper, and the caterpillar, My great army, which I sent among you.