An extensive body of evidence from this last decade indicates that melatonin enhances plant resistance to several biotic and abiotic stressors. This has led to an interest in the use of melatonin in agriculture to reduce negative physiological effects from environmental stresses that affect yield and crop quality. However, there are no reports regarding the effects of melatonin on soil microbial communities under abiotic stress, despite the importance of microbes for plant root health and function. Three agricultural soils associated with different land usage histories (pasture, canola or wheat) were placed under abiotic stress by cadmium (100 or 280 mg/kg) or salt (4 or 7 g/kg) and treated with melatonin (0.2 and 4 mg/kg). Automated Ribosomal Intergenic Spacer Analysis (ARISA) was used to generate Operational Taxonomic Units (OTU) for microbial community analysis in each soil. Significant differences in richness (α diversity) and community structures (β diversity) were observed between bacterial and fungal assemblages across all three soils, demonstrating the effect of melatonin on soil microbial communities under abiotic stress. The analysis also indicated that the microbial response to melatonin is governed by the type of soil and history. The effects of melatonin on soil microbes needs to be regarded in potential future agricultural applications.