Your pastor was only echoing what the Bible tells us about troubles, namely, that God can use them to make our faith stronger and draw us closer to Himself. The Bible says, "Consider it pure joy, my brothers, whenever you face trials of many kinds.... so that you may be mature and complete" (James 1:2, 4).
Think of it this way: Suppose you never got any physical exercise; all you did was sit in your chair or lie in bed all day. What would happen to your muscles? You know the answer: They'd grow weaker and weaker, and eventually you might not even be able to get out of bed. Our muscles only become strong if we exercise them and challenge them to do more. The more resistance they face, the stronger they'll get.
The same is true spiritually. If our faith is never challenged... if we never have to put it to work... then our spiritual "muscles" will grow weaker and weaker. But when hardships and trials come into our lives, we'll be forced to exercise those spiritual "muscles" -- and when we do, our faith will grow stronger. We'll discover that God still loves us and is with us, and He can be trusted to lead us through life's storms. The Bible says, "We know that suffering produces perseverance; perseverance, character; and character, hope" (Romans 5:3-4).
Thank God that He will never abandon you, no matter what comes your way. And when hard times do come, turn to Him and ask Him to use them to help you grow in your faith.