Multiple times.
Hebrew writing frequently makes a "dual prophecy" - that is, the prophet states something that will have a temporal fulfilment and a spiritual fulfilment, or an application in his day and an application at one (or both) comings of the Messiah:
E.g.
Isaiah spoke in such a manner that his words find application and fulfillment in many different ages or events in world history. (see Ludlow Isaiah - Prophet, Seer, and Poet p. 54)
--
Examples
The most obvious application of the prophecy would be the conquest of Jerusalem by Babylon in 586 BC, which occurred just a few years after Ezekiel made this pronouncent. In this sense, Ezekiel is offering one of God's final warnings--the people have been wicked, and they will be purged & purified.
Second-temple Jews would have seen a clear application of this prophecy to their own day, when Jerusalem was again destroyed, this time by Titus, in AD 70. The city was literally burned, as was the temple, where numerous Jewish people had gathered in hopes of safety.
Consider that just a few verses prior (see v. 15) Ezekiel speaks of the people being scattered. There is a clear application to both of the historical events noted above. In both cases the people had fallen into wickedness, they were pushed together into their final, holiest place of defense, and they were overthrown (with violence & fire) and scattered among other nations.
Many see in Biblical passages on scattering & gathering an ongoing work of the Lord, in purifying His people and gathering them physically and/or spiritually to Jerusalem and the truths taught therein.
--
Refining
Multiple times the Biblical writers spoke of God refining & purifying His people. The theme of scattering & gathering is common in the Old Testament, and especially in Isaiah. God promises to scatter & purge His people because of sin, and promises to gather them again. For example:
9 For my name’s sake will I defer mine banger, and for my praise
will I refrain for thee, that I cut thee not off.
10 Behold, I have refined thee, but not with silver; I have chosen
thee in the furnace of affliction.
11 For mine own sake, even for mine own sake, will I do it: for how
should my name be polluted? and I will not give my glory unto
another. (Isaiah 48:9-11)
&
2 But who may abide the day of his coming? and who shall stand
when he appeareth? for he is like a refiner’s fire, and like
fullers’ soap:
3 And he shall sit as a refiner and purifier of silver: and he shall
purify the sons of Levi, and purge them as gold and silver, that
they may offer unto the Lord an offering in righteousness.
4 Then shall the offering of Judah and Jerusalem be pleasant unto
the Lord, as in the days of old, and as in former years. (Malachi
3:2-4)
--
Conclusion
In these promises (and other similar passages), the Lord is not merely wreaking vengeance upon the wicked, He is purifying His people so that they can be what they were meant to be. God sees a bigger picture than just the immediate consequences. The fire of affliction does not destroy the silver, it separates the silver from impurity.
Since the silver & the dross are going separate ways, people must decide which part of themselves to leave behind, the silver or the dross.