This is a well studied topic and many scientists have asked your vary question! They found that any divalent ion will help attract the plasmid DNA to the cell; however, calcium has been found to have the added benefit of being readily absorbed by the membrane and once inside the cell, the calcium is easily neutralized. There is some debated as to how the pores by which the DNA enters the cells are affected by the calcium. Calcium weakens the membrane charge and increase permeability.
For a more comprehensive review, you may be interested in this paper: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5681917/