Gestational diabetes mellitus (GDM) not only has short-term side effects on offspring but also has an increased risk of developing chronic diseases in adulthood. The thymus gland is a vital organ of immune system and thymoquinone (TQ) has an immunomodulatory effect. This study aimed to investigate the long-term adverse effects of GDM on offspring’s thymus gland and the ameliorating effect of TQ. Pregnant rats were divided into four groups: C-group, T-group, GD-group, and GD + T-group. Offspring of all groups were subdivided into two subgroups, one sacrificed on day 21 and the other on day 42. The thymus of the offspring in the GD-group at both time points revealed a significant decrease in thymic weight, superoxide dismutase (SOD), and reduced glutathione (GSH) levels with a significant increase in malondialdehyde (MDA), interleukin-8 (IL-8), and tumor necrosis factor-alpha (TNF-α) levels. Moreover, there were microscopic degenerative changes, a significant decrease in C/M ratio, CD3, CD4, and CD8 immune expression, and a significant increase in activated caspase-3 immune expression. Interestingly, TQ administration revealed a significant increase in thymic weight, thymic SOD and GSH, C/M ratio, and CD3, CD4, and CD8 immune expression with a significant decrease in MDA, IL-8, TNF-α and activated caspase-3. For the first time, this study has shown that GDM causes long-term oxidative stress, apoptosis, and inflammation in offspring’s thymus and these changes could be attenuated by TQ.