In this paper we combine the extensive literature on the analysis of life course trajectories as sequences with the literature on causal inference, and propose a new matching approach to investigate the causal effect of the timing of life course events on subsequent outcomes. Our matching approach takes into account pre-event confounders that are both time-independent and time-dependent, as well as life course trajectories. After matching, treated and control individuals can be compared using standard statistical tests or regression models. We apply our approach to the study of the consequences of the age at retirement on subsequent health outcomes, using a unique dataset from Swedish administrative registers. Once selectivity in the timing of retirement is taken into account, effects on hospitalization are small, while early retirement has negative effects on survival. Our approach also allows for heterogeneous treatment effects. We show that the effects of early retirement differ according to pre-retirement income, with higher income individuals tending to benefit from early retirement, while the opposite is true for individuals with lower income.