In this paper, we analyze the effects of demographic change on a pay-as-you-go (PAYG) pension system, financed with a defined contribution scheme. In particular, we examine the relationship between retirement, fertility, and pensions in a three-period overlapping generations model. We focus on both the case of mandatory retirement and the case where the retirement age is freely chosen. In the case of mandatory retirement, increasing longevity has an unambiguously negative impact on fertility and pension payouts and a positive effect on the level of physical capital in the steady state. On the other hand, when agents choose the time of retirement, an increase in life expectancy positively affects physical capital only when the tax rate is sufficiently low and can have a positive impact on pension benefits, because agents may find it optimal to retire later and to decrease fertility less. Finally, the effects of the social security tax on capital per worker are negative with mandatory retirement; however, they could be positive in the optimal retirement case.