Yes — magnesium and calcium are commonly taken together and aren't expected to interact dangerously in healthy adults, but stay within recommended doses and check with your pharmacist, especially if you have kidney problems or take other medications.
These are two essential minerals your body needs every day, and they're routinely combined in the same supplements and multivitamins. The NIH Office of Dietary Supplements does not flag calcium as a meaningful threat to magnesium absorption — the only absorption interference it specifically names for magnesium comes from very high-dose zinc (around 142 mg/day), not calcium. The bigger practical issues aren't an interaction between the two minerals but taking too much of either, and the fact that both (magnesium in particular) can interfere with certain medications. Severe magnesium deficiency itself can lower blood calcium, so the two are biologically linked rather than antagonistic at normal intakes.
Keep doses sensible: the NHS says magnesium from supplements at 400 mg/day or less, and calcium at 1,500 mg/day or less, is unlikely to cause harm (NIH sets a supplemental magnesium upper limit of 350 mg/day and a total calcium upper limit of 2,000–2,500 mg/day). Too much magnesium causes diarrhea, nausea and cramping — and at extreme doses, irregular heartbeat or cardiac arrest; too much calcium is linked to constipation, stomach pain and kidney stones. Calcium absorbs best in doses of 500 mg or less at a time, so split larger amounts across the day. People with kidney disease or impaired kidney function should not take magnesium supplements without medical advice (they can build up to toxic levels), and anyone prone to kidney stones should be cautious with calcium. Magnesium and calcium can both bind certain antibiotics (tetracyclines and quinolones) and reduce their effect, so separate those — take the antibiotic at least 2 hours before or 4–6 hours after the mineral — and tell your pharmacist if you take diuretics, thyroid medication, osteoporosis drugs, or any prescription medicine. Call a professional if you have ongoing diarrhea, muscle weakness, confusion, an irregular heartbeat, or signs of a kidney stone.
This is general reference, not medical advice, and not a guarantee of safety. Interactions depend on your doses, health conditions, and other medicines. Always confirm with your pharmacist or doctor before combining products, and follow the dosing on each label.