Fire is a metaphor for God's judgment (see Isaiah 66:15; Jeremiah 4:4; Ezekiel 36:5; Amos 5:6). God's fire can destroy the wicked or, as in this context, test and purify the righteous.
Refine them … like gold: God acts as a divine metallurgist, using fire to remove impurities from metal (Isaiah 1:25; Malachi 3:2–3).
They are my people … The LORD is our God: These declarations of loyalty by God and Israel restore their broken covenant relationship (Zechariah 11:10, 14; see Exodus 19:5; Jeremiah 30:22; 31:33; Hosea 2:23).