Yes, it does affect your occupational retirement provision (pension fund). However, in most cases, missing contributions can be minimized with higher wages. In addition, you can still make pension fund purchases at a later date.
If you are studying, paying the minimum OASI contribution each year is important. In 2022, this will be CHF 503. These minimum contributions will also be minimized later by your higher wages.