ImportanceFood insecurity is a leading public health issue in the US. Research on food insecurity and cognitive aging is scarce, and is mostly cross-sectional. Food insecurity status and cognition both can change over the life course, but their longitudinal relationship remains unexplored.ObjectiveTo examine the longitudinal association between food insecurity and changes in memory function during a period of 18 years among middle to older–aged adults in the US.Design, Setting, and ParticipantsThe Health and Retirement Study is an ongoing population-based cohort study of individuals aged 50 years or older. Participants with nonmissing information on their food insecurity in 1998 who contributed information on memory function at least once over the study period (1998-2016) were included. To account for time-varying confounding and censoring, marginal structural models were created, using inverse probability weighting. Data analyses were conducted between May 9 and November 30, 2022.Main outcomes and MeasuresIn each biennial interview, food insecurity status (yes/no) was assessed by asking respondents whether they had enough money to buy food or ate less than they felt they should. Memory function was a composite score based on self-completed immediate and delayed word recall task of a 10-word list and proxy-assessed validated instruments.ResultsThe analytic sample included 12 609 respondents (mean [SD] age, 67.7 [11.0] years, 8146 [64.60%] women, 10 277 [81.51%] non-Hispanic White), including 11 951 food-secure and 658 food-insecure individuals in 1998. Over time, the memory function of the food-secure respondents decreased by 0.045 SD units annually (β for time, −0.045; 95% CI, −0.046 to −0.045 SD units). The memory decline rate was faster among food-insecure respondents than food-secure respondents, although the magnitude of the coefficient was small (β for food insecurity × time, −0.0030; 95% CI, −0.0062 to −0.00018 SD units), which translates to an estimated 0.67 additional (ie, excess) years of memory aging over a 10-year period for food-insecure respondents compared with food-secure respondents.Conclusions and RelevanceIn this cohort study of middle to older–aged individuals, food insecurity was associated with slightly faster memory decline, suggesting possible long-term negative cognitive function outcomes associated with exposure to food insecurity in older age.