Don't save in the wrong place: pay the annual minimum contribution into AHV even when you're abroad (2020: 496 francs). If necessary, you can make up contribution gaps within five years. But that's the limit, and your AHV pension will be reduced by about 2.3% for each contribution year that you miss.
What should you be aware of with regard to pension funds?
Your obligation to pay into your pension fund doesn't apply anymore when you end your employment in Switzerland. Some pension funds allow you to still remain insured for temporary stays abroad. If your pension fund doesn't offer this service, you can have your retirement savings maintained by the UBS Vested Benefits Foundation (ubs.com/vb).
Retain your pillar 3a account, tax-free
By the way, you can't pay into pillar 3a if you don't have any income that is subject to AHV in Switzerland. However, you can still retain your pillar 3a account free of tax during your stay abroad.
Have you thought of everything?
Read the most important things to do if you move abroad.