It may take up to eight weeks of magnesium supplementation to notice a significant improvement in sleep quality. See what factors affect it.