In the United States, people often use the door of the refrigerator as a sort of bulletin board. They will put messages there, reminders to do things--and they are held in place with magnets (the door of the refrigerator is metallic) which are manufactured specifically for this purpose. What the author means is that the friend had brought back such a magnet which was encased in plastic and made to look like a sombrero. The juxtaposition of sombrero and magnet is merely fortuitous--it would be more accurate to say a magnet disguised as a sombrero.
In the image below, you see a refrigerator door to which several magnetized objects have been attached. One of them is someone wearing a sombrero--i didn't immediately find an image of a sombrero magnet, but i'm not going to spend a lot of time on this.