1. It is both an Indicator of BN and MN, but also to protect the magnet and fingers should they get trapped between it and a ferrous surface.
2. The foam also helps separate two magnets in case they inadvertently get together. Without the foam, they can grab pretty tightly.
For more information please check this link: