No. The energies involved here are just too great.
First of all the "spear" would be gravitationally unstable, it would collapse upon itself and fold into a ball of metal, you couldn't make it strong enough.
Even if you solve that problem, then in the collision with the planet a lot of energy is released. This would be enough to vapourise the spear and the rock. If you get the rod moving fast and it is long enough you begin to dig a larger and larger crater, but before you get to the "impale" the planet, you have released enough energy to completely melt the planet, and in the process, completely melt the spear.
So no impaled but inhabitable planet, if you want to maintain realism.
If you magic away the impaling process, then there is not so much to change. The internal heat of the Earth melts the rod, the dynamo that powers the magnetic field would continue to operate. The rod would not be able to support its own weight (and if it broke up and fell to Earth, the damage would probably wipe out all complex life) so you will need more magic if you want to keep it sticking out the ground.
With sufficient application of magic almost anything is possible.