Pension Insurance
The requirement to be insured applies regardless of where you reside in the country of employment.
Employers are required to enroll employees in the pension insurance system. A social security number is assigned for this purpose. It is issued when an employee begins their first job and is valid for life. It should therefore be kept in a safe place.
Entitlement to a retirement pension in Germany begins upon reaching the standard German retirement age and after the general waiting period of 5 years has been fulfilled. Since contribution periods are recognized across EU member states, you are also entitled to a pension even if you have paid into the German pension system for less than 5 years. The key requirement is that social security contributions have been paid for a total of at least five years, with at least one year in each country.
However, the German Pension Insurance will then pay out only the amount corresponding to the time spent in Germany.
Further information: https://www.deutsche-rentenversicherung.de/