Permanent magnets are made by exposing certain materials (such as NdFeB or SmCo) to a strong external magnetic field during their production. This field aligns the magnetic domains within the material, and after cooling or solidification, the material retains its magnetic properties.