1 Peter 1:6-7 Wherein ye greatly rejoice, though now for a season, if need be, ye are in heaviness through manifold temptations: That the trial of your faith, being much more precious than of gold that perisheth, though it be tried with fire, might be found unto praise and honour and glory at the appearing of Jesus Christ:
Sometimes trials came along and jerk the rug out from under us, but it never takes God by surprise. He knew about it before it happened and had already made a way to bring you out.
Peter speaks of the refining process that gold goes through. When put to the flame, the impurities and dross in the gold come to the top, resulting in a far purer gold.
Jesus allows us to go through the fire to remove from our lives things that are not needed, to give us a closer and purer relationship with Him. He Is always with us. He never leaves us nor forsake us.
We may not understand it until we stand before the Lord in Heaven and are rewarded for our walk with Him and for the sufferings we endured.