If you work and pay tax in Sweden then you will earn a Swedish retirement pension. You are entitled to the pension even if you live in another country.
The Swedish retirement pension is made up of several components: income pension (inkomstpension), premium pension (premiepension), occupational pension (tjänstpension) and private pension (eget sparande).
Every year 18.5% of your salary is set aside for your basic national retirement pension (allmänna pensionen). 16% goes to your income pension and 2.5% to your premium pension.
Most workers in Sweden receive additional occupational pension contributions from their employer. Many people also choose to make private contributions into their private pension.
Even if you move to another country, you will keep your Swedish retirement pension. You apply for your pension through the Swedish Pensions Agency. For more information, see Swedish Pensions Agency - How to apply if you live outside Sweden.
Sweden also has a so called guaranteed pension (garantipension) for people with low or no income pension. If you have a guaranteed pension you will only keep it if you move to another EU or EEA country, Switzerland, and in some cases Canada.