Both are used as laxatives and work by softening stool. However, they have different compositions. Milk of magnesia is a form of magnesium hydroxide. MiraLax contains polyethylene glycol, a compound derived from petroleum. With MiraLax, it can take one to three days to become regular. Milk of magnesia may cause a bowel movement within a half hour to six hours. Long-term use of magnesium laxatives like milk of magnesia is not recommended.