Research on frailty, a major contributor to heterogeneity in health, is undertaken on older adults although the processes leading to frailty are likely to begin earlier in the life course. Using repeat data spanning 25years, we examined changes in physical and mental functioning before the onset of frailty, defined using Fried's frailty phenotype (FFP). Functioning was measured using the Short-Form 36 General Health Survey (SF-36) on nine occasions from 1991 (age range 40-63years) to 2015 (age range 63-85years). The poorest of four FFP scores from 2002, 2007, 2012 and 2015 was used to classify participants as frail, pre-frail, or robust. We used linear mixed models with a backward timescale such that time 0 was the person-specific date of frailty classification for frail and pre-frail participants and the end of follow-up for robust participants. Analyses adjusted for socio-demographic factors, health behaviours, body mass index and multi-morbidity status were used to compare SF-36 physical (PCS) and mental (MCS) component summary scores over 25years before time 0 as a function of FFP classification, with estimates extracted at time 0, -5, -10, -15, -20 and -25years. We also used illness-death models to examine the prospective association between SF-36 component summary scores at age 50 and incident FFP-defined frailty. Among 7044 participants of the Whitehall II cohort study included in the analysis [29% female, mean age 49.7 (SD=6.0) at baseline in 1991], 2055 (29%) participants remained robust, and 4476 (64%) became pre-frail and 513 (7%) frail during follow-up. Frail compared with robust participants had lower SF-36 scores at t=-25 before onset of frailty with a difference of 3.4 [95% confidence interval (CI) 1.6, 5.1] in PCS and 1.8 (-0.2, 3.8) in MCS. At t=0, the differences increased to 11.5 (10.5, 12.5) and 9.1 (8.0, 10.2), respectively. The differences in SF-36 between the robust and pre-frail groups, although smaller [at t=0, 1.7 (1.2, 2.2) in PCS and 4.0 (3.4, 4.5) in MCS], were already observed 20 and 25years, respectively, before the onset of pre-frailty. Prospective analyses showed that at age 50, scores in the bottom quartiles of PCS [hazard ratio (HR) compared with the top quartile=2.39, 95% CI 1.85, 3.07] and MCS [HR=1.49 (1.15, 1.93)] were associated with a higher risk of FFP-defined frailty at older ages. Differences in trajectories of physical and mental functioning in individuals who developed physical frailty at older ages were observable 25years before onset of FFP-defined frailty. These findings highlight the need for a life course approach in efforts to prevent frailty.