Background
Most kidney stones (~80%) are calcium stones, and the majority of those are primarily composed of calcium oxalate. Oxalate (C2O42−) is a dianion that combines with divalent cations such as magnesium and calcium. The magnesium salt is much more soluble than the calcium salt. Because these cations compete for binding to oxalate, both lower magnesium levels and higher calcium levels will tend to cause precipitation (movement out of solution into crystalline form) of calcium oxalate. When this happens in the urine in large enough quantities, it can form “stones.”
Does diet matter?
As introduced by the OP, doctors have historically advised patients who have demonstrated a propensity toward calcium oxalate stone formation (or, more generically: kidney stones) to decrease dietary intake of calcium and oxalate.
Dietary calcium
In 1993, a study published in the New England Journal of Medicine dispelled the notion that a low calcium diet should be advised for these patients. They found the opposite association: higher calcium intake correlates with reduced stone formation (RR = 0.56; 95% CI 0.43 - 0.73). This somewhat counter-intuitive effect may be explained by the binding of calcium with oxalate in the gut, which tends to decrease oxalate absorption. The recommendation to decrease calcium intake, then, appears not to be valid. Further studies have refined this recommendation, and it is now generally said that a normal calcium intake is probably best.
Dietary oxalate
Oxalate is found in an odd assortment of foods: beets, spinach, rhubarb, strawberries, nuts, chocolate, tea, wheat bran, and all dry beans (fresh, canned, or cooked), excluding lima and green beans. This has largely been a “seems like it should work” approach rather than data-driven. In fact, large epidemiological studies have not shown an association between oxalate intake and stone formation.
Other dietary associations
The NEJM study mentioned above also looked at other correlations between stone formation and dietary components. Animal protein was directly correlated with increased risk of stones, whereas potassium and fluid intake were correlated with decreased risk.
A different approach
The most recent interesting development in this area that I’m aware of was published in the American Journal of Kidney Disease in 2014 and compared the DASH (Dietary Approaches to Stop Hypertension)-style diet with a low-oxalate diet for prevention of stones. Their reasoning is nicely summarized in the abstract:
[M]ost people do not eat isolated nutrients, but meals consisting of a variety of foods with complex combinations of nutrients. A more rational approach to nephrolithiasis prevention would be to base dietary advice on the cumulative effects of foods and different dietary patterns rather than single nutrients.
The DASH diet was, as its name suggests, developed as a tool to mitigate hypertension, but it has been used as a sort of paradigm “healthy diet” in trials of a variety of interventions. It is, as described in the paper above, high in fruits and vegetables, moderate in low-fat dairy products, and low in animal protein. The high fruit and nut content may be expected to increase urinary oxalate, but these foods also tend to be high in magnesium and citrate, both of which are inhibitors of calcium stone formation.
The authors collected 24-hour urine samples in participants with a known history of stones and randomized them to a DASH diet vs a low-oxalate diet. They found that urinary supersaturation of calcium oxalate (a measure of tendency to form calcium oxalate stones) was decreased in the DASH group compared to the low-oxalate group. This occurred despite a trend toward increased oxalate excretion in that group. The authors posit that this may have been due to the increased urinary pH and concentrations of citrate, magnesium, and potassium, all of which tend to decrease stone formation.
Conclusion
There are not solid data supporting a low oxalate diet for stone prevention. Other dietary factors that are probably helpful include: normal calcium intake; high intake of fluid, magnesium, and potassium; low animal protein.
References
Borghi L., Schianchi T., Meschi T., et al: Comparison of two diets for the prevention of recurrent stones in idiopathic hypercalciuria. N Engl J Med 2002(346):77-84.
Coe FL, Evan A, Worcester E. (2005). Kidney stone disease. J Clin Invest. 115(10):2598–2608.
Curhan G.C., Willett W.C., Rimm E.B., and Stampfer M.J.: A prospective study of dietary calcium and other nutrients and the risk of symptomatic kidney stones. N Engl J Med 1993(328):833-838.
Noori N, Honarkar E1, Goldfarb DS2, Kalantar-Zadeh K3, Taheri M1, Shakhssalim N1, Parvin M1, Basiri A. Urinary lithogenic risk profile in recurrent stone formers with hyperoxaluria: a randomized controlled trial comparing DASH (Dietary Approaches to Stop Hypertension)-style and low-oxalate diets.
Am J Kidney Dis.2014; 63(3):456-63.
Taylor E.N., and Curhan G.C.: Oxalate intake and the risk for nephrolithiasis. J Am Soc Nephrol 2007(18):2198-2204.