This answer focuses on the dietary sources of magnesium.
I've had this concern for a while too, considering many magnesium sources are found in carb-abundant foods (ie 1 cup crude bran= 230% RDA). here's my answer= HEMP SEED.
check out the nutritional profile= http://nutiva.com/nutrition/charts/organic-shelled-hempseed/
for 180 calories, you get 13.5 g fat, 2g carb (1 g fiber), 11g protein, and Magnesium 48% RDA.
you also get a nice boost of iron- 16%, Zinc- 23%, and not to mention that hemp is a balanced source of Omega 3-6 EFAs.
it's pricy, but if i'm lagging in magnesium/ iron, that's what i take. i see it as more of a supplement than anything
Other good sources of Magnesium include=
Cocoa powder provides 499mg of magnesium (125% RDA) per 100 gram serving or 429mg (107% RDA) per cup. Dark baking chocolate provides 327mg per 100 gram serving (82% RDA), or 95mg (24% RDA) per square.
Halibut has 182mg (46% RDA) per 6oz serving
Avocado has 58mg (15% RDA) per avocado (201 grams)
Spinach cooked has 79mg (19% RDA) per half cup (90 grams)
Brazil nuts have 19mg (5% RDA) in a SINGLE kernel or nut. And 1 serving of nuts is 1 oz (6 brazil nuts) so that's 30% right there.
*Other nuts and seeds have appreciable amounts of magnesium, like sunflower seeds, sesame tahini, and almonds, but they're also loaded with PUFA, which some Paleos might want to watch. Flax seeds provide 392mg (92% RDA) per 100 gram serving or 39mg (10% RDA) per tablespoon, but whether the PUFA content is worth it is up to you. However, i might note that Flax has more Omega-3 than Omega-6, so you're not getting much Omega-6 anyway.
Other things that interfere with Magnesium absorption=
People with Gastrointestinal Disorders - Most magnesium is absorbed through the colon so people with gastrointestinal disorders like Crohn's disease are at high risk for a magnesium deficiency.
People with Poor Functioning Kidneys - The kidneys should be able to regulate magnesium in the blood, excreting less when stores are low, however, excessive loss of magnesium through urine can occur to people on specific medications, poorly managed diabetes, and alcoholics.
The Elderly - As we age the amount of magnesium we absorb decreases as the amount we excrete increases.
People Consuming high amounts of Fiber - Eating large amounts of fiber has been shown to interfere with the bodies ability to use magnesium. However, more research needs to be done to confirm how much fiber affects magnesium.30,31
People on a low protein diet (*Controversial) - Eating less than 30 grams of protein a day may adversely affect magnesium utilization
People taking Certain Medications
Diuretics: Lasix, Bumex, Edecrin, and hydrochlorothiazide
Antibiotics: Gentamicin, and Amphotericin
Anti-neoplastic (Cancer) medication: Cisplatin
Zinc Supplements