This is produced by planets having a liquid core of some metallic material. The Earth produces one by having
a liquid outer core of nickel and iron.