On March 16, 2020, French schools suddenly closed due to the COVID-19 pandemic, and middle school students were asked to study from home with no direct interactions with teachers or classmates. However, school plays an important role in the development of social, intellectual, and mental competencies and can counteract the negative effects of adverse life events on learning and early school dropout. In this study, we investigated how the unusual context of school closure during the COVID-19 pandemic affected school engagement. Specifically, we focused on inter-individual differences in the motivational determinants of school engagement. We thus performed an online survey of 170 students focusing on the time spent on mathematics assignments, motivation regulation, implicit theories of intelligence, such as adopting a growth or a fixed mindset about his/her intellectual abilities, and optimism. Importantly, the students participated in the online survey during the first lockdown period, with schools closed (T1), and the second lockdown period, with schools remaining open (T2). During T1, identified motivation positively predicted the time spent on math homework assignments: the more the students thought that working on math exercises was useful for their future life, the more time they spent studying. Importantly, the link between identified motivation and school engagement was specific to T1, when schools were closed, as indicated by a significant interaction between identified motivations by type of lockdown. These results suggest that having self-determined motivation is of particular importance when students are deprived of social and intellectual interactions with classmates and teachers. This finding paves the way toward the development of wise rational interventions that target identified motivation and can be applied during challenging societal times and adverse, common life events to keep students engaged with school.