In Joel 1:4 and 2:25, what do the locusts represent? 

Some readers understand the locust hordes literally; others, as the invading armies the Lord would use to punish his people.

Since the nearby desert was the breeding grounds for locusts, and these insects were well known for their whirring wings, chomping jaws, and ability to burn and bleach the land -- one large swarm can devastate the countryside in a matter of hours! -- locusts are an apt illustration of a foreign army. The images of Joel would have struck fear into his readers/listeners. Prophetic language is often colorful; by hook or crook, by all means possible, the Lord desires that we appreciate the seriousness of the message, and that we know him in his holiness.

Other non-literal features of Joel's prophecies include apocalyptic language (2:10,20, 3:15).

Weighing all the evidence, it would seem the real threat to the people of God were invading soldiers, not invading insects.