there is a lot of metal in the universe. The larger the mass of metal the stronger the magnetic pull. Over 30% of all white dwarfs for example has lots of metal in them they have 4 million times the magnetic pull then the earth does or a two million times that of our sun.
Astrophysicist Rebecca Smethurst explain it a lot better than I can:
What's the probability that two stars collide when galaxies collide? [with equations!]