If you spend any length of time abroad, there are usually reciprocal agreements between EU countries. It's best to find out beforehand how it will affect you. Important is to keep a full record of where (country and employer) and when (time of employment) and to whom you paid contributions (insurance numbers!). The country to which you eventually apply can therefore gather the necessary information.
I live in Austria, worked in UK, Germany and Austria (where I have applied.) A fully detailed record was required, but the German and British insurance details were then sent to the Austrian authorities. These contributions were then recognised and included.
I assume it works the other way round, too.