In physics, magnetism is a component of the electromagnetic force. Magnetism is capable of attraction and repulsion of objects (in contrast with the force of gravity, which can only attract).
Permanent magnets, such as seen on refrigerators and in compasses, are made of certain kinds of material, called "ferromagnetic." Most metals and some ceramics are ferromagnetic. A ferromagnetic material is composed of many tiny regions, called "domains." These domains function as tiny magnets themselves. By aligning all of the domains, their effects combine rather than canceling out, creating a permanent magnet. A common way of performing this alignment is heating and cooling while near another pre-existing magnet.
In a permanent magnet, or a magnetic domain, the magnetism is caused by certain electron flows in the material, which result in "magnetic moment." When the magnetic moment of various atoms are aligned, a magnetic domain is created.
For more on the physics behind magnetism, see Electromagnetism.