The idea was that their beaks, which contain a lot of iron, worked like real magnets, with the metal aligning itself relative to the field.
The so-called trigeminal nerve transmitted this information to the brain.