。
I got caught in a sudden shower on the way.
Literal
On-the-way [at-で] sudden-rain [at-に] met-[explanatory-んだ] [emphatic-よ].
にわか雨 ('sudden shower') is a single word, combining にわか ('sudden, abrupt') with 雨. 雨に会う / 雨にあう ('to meet rain') is the idiomatic way to say 'get caught in rain' — 'to meet' treated almost as if the rain were a person one encounters. The んだ at the end is the contracted explanatory のだ, often added in casual speech to offer context to the listener.