The best time of day to take magnesium varies according to its intended use. If using magnesium as a laxative or sleep aid, take magnesium before bedtime, notes WebMD.
According to WebMD, magnesium deficiency and heartburn are treated by four doses six hours apart. This is difficult to accomplish since most people sleep about eight hours. If the first daily dose is taken at 6 a.m., the the next three doses should be taken at noon, 6 p.m. and midnight. Adult migraines are treated with two daily doses. WebMD does not specify the time required between doses. Doctor Oz recommends eating at least five magnesium-rich foods throughout the day because the body needs a constant supply of magnesium all day long.