Yes you can take them together but you do not have to. Just take them.
An FYI if you have not already read it is…
“What we say”
“The Vitamin D Council believes that the daily amounts of magnesium recommended by the Food and Nutrition Board aren’t enough to keep your body healthy; and that both men and women may need more than is recommended.” ” Some research studies show that your body needs between 500 and 700 mg a day.” (Try to take a magnesium other than Oxide. It does not absorb as well as others.)