Gold is refined by the fire which heats it until the impurities come out. When we are in a trial in our life is representational of this fire. God uses it for good and often we come out a better person if we allow God to do a work in our heart.
See, I have refined you, though not as silver;
I have tested you in the furnace of affliction.
Isaiah 48:10