Elastic properties of magnetic filaments linked by DNA in solutions of univalent and bivalent salts with different pH values are investigated through their deformation in an external field. A strong dependence of the bending modulus in bivalent salt solution on the pH is shown. Experimental results are interpreted on the basis of the magnetic elastica.