I don't know for Germany, but you'll usually have option to receive your pension from abroad, or have it dumped in a local account for later, or transfered to your permanent residency country.
It's always a PITA with no straightforward way, but if you paid for 20 years you'll probably be motivated to go through the hoops to see that money back in some form.
And if you don't qualify, you can get your pension payments refunded (but not your employer's share). If you left Germany, you definitely ought to do it.