Melatonin has been shown to exert protective effect during myocardial ischemia/reperfusion (I/R). However, the underlying mechanism is not completely understood. Using the oxygen-glucose deprivation and reperfusion (OGD/R) model of H9c2 cells in vitro, we found that melatonin alleviated OGD/R-induced H9c2 cell injury via inhibiting Foxo3a/Bim signaling pathway. Inhibition of Rac1 activation contributed to the protective effect of melatonin against OGD/R injury in H9c2 cells. Additionally, melatonin inhibited OGD/R-activated Foxo3a/Bim signaling pathway through inactivation of Rac1. Furthermore, JNK inactivation was responsible for Rac1 inhibition-mediated inactivation of Foxo3a/Bim signaling pathway and decreased cell injury in melatonin-treated H9c2 cells. Taken together, these findings identified a Rac1/JNK/Foxo3a/Bim signaling pathway in melatonin-induced protective effect against OGD/R injury in H9c2 cells. This study provided a novel insight into the protective mechanism of melatonin against myocardial I/R injury.