Background: Adult rodent studies showed that melatonin is very effective in treatment of ameliorating cardiovascular disease. Melatonin is also able to reduce cardiac hypertrophy and heart failure (HF) in juvenile rodents. Here, we study the effect of melatonin on the cardiac function of juvenile rats with HF. Methods: Juvenile rats with HF were induced by abdominal aortic constriction (AAC). Sham-operated rats were established in parallel. Five weeks after the surgery, rats with ventricular dysfunction were randomly divided into two groups: the treatment group was injected with melatonin (10 mg/kg/d, intraperitoneal injection), and the HF group was injected with placebo. Simultaneously, placebo was administered to the sham group. Results: After administration for 4 weeks, the treated rats did not exhibit a decline in cardiac function as assessed by echocardiography analysis. Moreover, the increase in expression of ANP, BNP, caspase-1, IL-1β, bax, CaMKII, PLN, and RyR2 was markedly blunted by melatonin, while the decrease in expression of bcl-2 was improved in the melatonin treated rats. Conclusions: Our findings support a protective role of melatonin in cardiomyocytes, at least in part via reducing cardiac pyroptosis, apoptosis and remaining calcium homeostasis.