This study assessed the effect of KCNMA1 transfected bone marrow-mesenchymal stem cells (BM-MSCs) on the improvement of erectile function in diabetic rats. Sixty male Sprague–Dawley rats were injected with streptozotocin (STZ) and screened with apomorphine (APO) to establish diabetes mellitus-induced erectile dysfunction (DMED). DMED rats were randomly divided into four groups: rats in each group underwent intracavernous injection with either phosphate buffer solution (DMED+PBS), nontransfected MSCs (DMED+MSCs), empty vector transfected MSCs (DMED+null-MSCs) or KCNMA1 transfected MSCs (DMED+KCNMA1-MSCs). Before injection, high levels of KCNMA1 expression were confirmed in KCNMA1-MSCs using RT-PCR and Western blotting. The lentivirus transfected MSCs maintained their potential for multidirectional differentiation. Four weeks after injection, erectile function was ascertained by measuring intracavernous pressure (ICP). Penile tissues were collected for immunohistochemical analysis. The expression of KCNMA1 in the corpus cavernosum was increased, and the DMED+KCNMA1-MSCs group displayed a significant improvement of erectile function. We concluded that KCNMA1 was able to enhance the positive effect of MSCs in the treatment of diabetes-associated erectile dysfunction.