Bioleaching is a promising process for 350 million tons Jinchuan low-grade pentlandite. But, Jinchuan pentlandite has lots of magnesium and high concentration of Mg2+ is harmful to bioleaching microorganisms. Thus, finding a way to improve the adaption of microorganisms to Mg2+ is a key for bioleaching. In the study, we found that oxidizing activity, bioleaching ability and biofilm formation of A.f were inhibited by Mg2+ stress. In addition, we analyzed mRNA and small RNA (sRNA) of Acidithiobacillus ferrooxidans (A.f) under Mg2+ stress by strand-specific RNA-sequencing (ssRNA-seq). After the bioinformatics process, 2475 coding genes were obtained, and there were 33 differential expression genes (DEGs) in 0.1 M-VS-Con, including 28 down-regulated and 5 up-regulated, whereas 52 DEGs were obtained in 0.5 M-VS-Con, including 28 down-regulated and 24 up-regulated. Gene ontology analysis showed most of DEGs were involved in catalytic activity, metabolic process and single-organism process. Furthermore, we identified 636 sRNA and some differential expression sRNA that may respond to Mg2+ stress. Further analysis of DEGs suggested that Mg2+ stress reduced biofilm formation perhaps through inhibiting Type IV Pili-related gene expression and inhibited bacterial activity perhaps through affecting carbon fixation. The study provided the foundation to understand the mechanisms of Mg2+ resistance in A.f and may be helpful to improve bioleaching ability for pentlandit.