A growing number of couples experience fertility issues with almost half being due to malefactors. The exposure to toxic environmental contaminants, such as endocrine disruptors (EDs), has been shown to negatively affect male fertility. EDs are present in the environment, and exposure to these toxins results in the failure of spermatogenesis. The deleterious effects of EDs on spermatogenesis have been well documented, whereas improvement of infertility associated with spermatogenesis defects remains a great challenge. Herein, we report that in vitro exposure of prepuberal mouse testes to two well-known endocrine disruptors (EDs), bisphenol A (BPA) or diethylhexyl phthalate (DEHP), impairs spermatogenesis with perturbing self-renewal, spermatogonia activity, and meiosis. Evidence indicates that such effects are likely due, at least in part, to decreased G9a-dependent H3K9 di-methylation. Of note, we found that melatonin (MLT) protected the testis from the negative ED impacts with preserving spermatogonia stem and meiotic cells, along with maintaining normal H3K9 di-methylation in these cells. Taken together, this work documents that BPA and EDHP adversely affect prepuberal spermatogenesis and perturb crucial epigenetic activities in male germ cells and highlight the protective ability of MLT.