What keeps the earth stable so that it doesn’t get pulled up into the “magnet”?
If you are asking why doesn’t the earth itself get pulled up toward a large magnet or electromagnet that I’m holding in my hand, the answer is that the magnetic forces just aren’t strong enough to pull the magnet and earth together. I’m holding the two apart with other forces and preventing them from pulling together. The forces between poles diminish with distance. Those forces are proportional to the inverse square of the distance between poles, so they fall off very quickly as the poles move apart. Moreover, each north pole is connected to a south pole on the same magnet, so the attraction between opposite poles on two separate magnets is mitigated by the repulsions of the other poles on those same magnets. As a result, the forces between two bar magnets fall over even faster than the simple inverse square law predicts. It would take an incredible magnet, something like a spinning neutron star, to exert magnet forces strong enough to damage the earth. But then a neutron star would exert gravitational forces that would damage the earth, too, so you’d hardly notice the magnetic effects.