Several drugs including diuretics and proton-pump inhibitors can cause magnesium loss and hypomagnesemia.