It can take up to a year to correct a severe magnesium deficiency, since magnesium is a difficult mineral to transport across intestinal membrane. Magnesium citrate is a highly absorbable form of magnesium. Chelated magnesium products are very easy to transport across membrane, but expensive - I don't know how much of that type would be of benefit to you.
Since you are magnesium deficient, a good form of cleansing for you, in addition to other methods, might be drinking a bottle of magnesium citrate laxative once per week. The bottles are 8 oz. each, and sold at pharmacies. I would also suggest making potassium rich broths to nourish your health, and to gradually correct your intestinal microbial balance, miso soup.
I agree with the other posters who suggest using one of the gentle magnesium cleansing products for your bowels.