Obstructive sleep apnea (OSA) associated with chronic intermittent hypoxia (CIH) increases the morbidity and mortality of ischemic heart disease in patients. Yet, there is a paucity of preventive measures targeting the pathogenesis of CIH-induced myocardial injury. We examined the cardioprotective effect of melatonin against the inflammation, fibrosis and the deteriorated sarcoplasmic reticulum (SR) Ca2+ homeostasis, and ischemia/reperfusion (I/R)-induced injury exacerbated by CIH. Adult male Sprague Dawley rats that had received a daily injection of melatonin (10 mg/kg) or vehicle were exposed to CIH treatment mimicking a severe OSA condition for 4 wk. Systolic pressure, heart weights, and malondialdehyde were significantly increased in hypoxic rats but not in the melatonin-treated group, when compared with the normoxic control. Levels of the expression of inflammatory cytokines (TNF-α, IL-6, and COX-2) and fibrotic markers (PC1 and TGF-β) were significantly elevated in the hypoxic group but were normalized by melatonin. Additionally, infarct size of isolated hearts with regional I/R was substantial in the hypoxic group treated with vehicle but not in the melatonin-treated group. Moreover, melatonin treatment mitigated the SR-Ca2+ homeostasis in the cardiomyocyte during I/R with (i) Ca2+ overloading, (ii) decreased SR-Ca2+ content, (iii) lowered expression and activity of Ca2+-handling proteins (SERCA2a and NCX1),and (iv) decreased expressions of CAMKII and phosphorylated eNOSser1177. Furthermore, melatonin ameliorated the level of expression of antioxidant enzymes (CAT and MnSOD) and NADPH oxidase (p22 and NOX2). Results support a prophylactic usage of melatonin in OSA patients, which protects against CIH-induced myocardial inflammation and fibrosis with impaired SR-Ca2+ handling and exacerbated I/R injury.