That would only be true if you made 100% of your pension contributions at 25 and bought an annuity at 100, with no withdrawals in the interim.
The reality is that retirement savings are gradually built up over time (with increasing contributions and compounding returns) and then gradually spent down over time so your time horizon is constantly shifting.
There's no way to precisely calculate your investment horizon in advance, but I think a reasonable estimate would be half your life expectancy at a particular age. That would give you a crude estimate of the average time that each euro will remain invested in the market.
So, on that basis, a 40 year-old has an investment horizon of roughly 22.5 years, whereas a 60 year-old has an investment horizon of roughly 12.5 years.