Objective To examine the impact of acute illness on long-term health and describe any differences in these associations between socioeconomic and ethnic groups. Design Longitudinal population study. Setting Linked primary and secondary care data recorded in the Clinical Practice Research Datalink (CPRD). Participants Adults ([≥]18 years) residing in England registered with a primary care general practice (GP) between 1st January 2012 and 31st December 2022 who have not opted out of inclusion into CPRD and linked data sources. Socioeconomic deprivation was defined using the Index of Multiple Deprivation (IMD) and ethnicity by UK census 2011 definitions. Main outcome measures The primary outcome was new long-term disease and multimorbidity (two or more long-term diseases). We describe incidence of hospitalisation for acute illness as the exposure. Results We included 18,329,659 people, with 9,339,394 (51.0%) women, 7,430,555 (40.5%) people from the most deprived deciles (IMD 1-4) and 3,009,717 (16.4%) from a minority ethnic group. 6,038,272 (32.9%) people experienced hospitalisation for acute illness. Hospitalisation was associated with increased onset of long-term disease in those alive at the end of follow up (41.1% hospitalised vs 18.7% not hospitalised; adjusted HR 2.48 (2.47 to 2.48)). Compared to non-hospitalised, those who had been hospitalised were more likely to change from being disease free at baseline to having a new long-term disease (12.9% vs. 7.5%), develop multimorbidity (4.7% vs. 1.1%), or transition to multimorbidity if they had pre-existing disease (8.1% vs. 1.8%). Age-standardised hospitalisation rates were highest in the most deprived decile and in people with Black ethnicity. Comparative hospitalisation ratio for IMD 1 compared to IMD 10 ranging from 1.78 in 2018 to 1.96 in 2021 and for Black ethnicity compared to White ranging from 1.03 in 2017 to 1.08 in 2021. Conclusions Acute hospitalisation is a key stage in the development of long-term disease and may be an underutilised opportunity for intervention to change healthy life trajectory and reduce health inequality.