What will happen if a magnetar gets close to Earth? I have studied that magnetars are a type of neutron stars which are the most powerful magnets in the Universe. Their field strength can be of $10^{13}$ Tesla or even more. What effect would one have on the Earth if it is close by? Will all iron and other magnetic objects fly into space, or will the inner core of earth containing iron and cobalt come out?
If we put a normal magnet near a nail it lifts up. So if a magnetar comes within a distance, say as close as the ISS, will it be able to lift objects from Earth? For instance, could a car fly into space?
 A: A magnetar is thought to be a highly magnetised neutron star, with a radius of $\sim 10$ km and a surface magnetic field strength of $\sim 10^{12}$ Teslas in extreme cases.
If we assume a dipole field for the magnetar, then the field strength declines roughly as $r^{-3}$. So to have a field strength similar to that at the surface of of a strong neodymium magnet (about $\sim 1$ Tesla), the neutron star would have to be at a distance of $10^{5}$ km away.
If a neutron star was only 100,000 km away, then the magnetic field would be the least of your worries.
The tidal force due to the neutron star is something like $\pm 2(GM/r^3)\Delta r$, where $\Delta r$ is a characteristic size of an object in the radial direction. Putting some units on this, we find that the tidal acceleration across an object of size 1m due to a 1.4$M_{\odot}$ neutron star at a distance of $10^{8}$m would be only $3.7 \times 10^{-4}$ m s$^{-2}$ -- so not particularly important for an individual, but note that the tidal forces would be 2 billion times stronger than that due to the Moon; the tidal acceleration across the Earth's radius would be $2.4 \times 10^{3}$ m s$^{-2}$ and thus easily able to rip it apart.
Magnetars are young neutron stars with highly energetic radiation from their surfaces and magnetospheres. At a distance of $10^{8}$ m, the Earth would be totally sterilised, and since surface temperatures are of order $10^{7}$ K; the magnetars would have the luminosity of 2000 Suns and just the blackbody flux at the Earth would be $>10^{12}$ W/m$^2$.
