The cause of magnetism is attributed to the alignment of microscopic magnetic domains within certain materials. These materials, such as iron, nickel, and cobalt, have unpaired electrons that create a magnetic field around them. When these domains align in the same direction, they create a stronger overall magnetic effect.