Very common phenomenon. It is an example of stress induced magnetization, or piezomagnetism, and is apparently caused by preferential orientation of the previously randomly oriented magnetic domains. There is also an inverse effect called magnetostriction, where you get a stress developed by applying a magnetic field. But giving something a fancy name doth not an explanation make. At least if you have the scientific name, however, you can research the subject should you so desire. There are a lot of very complex and recent papers out there, which probably means that nobody quite understands it yet. I remember an old Magyver episode in which someone had dropped a key (or something) down a drain, and he took a long steel rod, banged it on the ground a few times, and then proclaimed "now it's a magnet", and immediately retrieved the key (or whatever). If only life were that simple. Another somewhat related example which comes to mind is a problem the Germans had with their V1 missiles. The residual magnetic field of the metal skin messed up the compass used for direction control, and their low tech yet somewhat un-Germanic solution was to have a whole bunch of guys banging on the things with mallets before launch, until the field was neutralized.