A ferrofluid (portmanteau of ferromagnetic and fluid) is a liquid that becomes strongly magnetized in the presence of a magnetic field. Ferrofluid was invented in 1963 by NASA’s Steve Papell as a liquid rocket fuel that could be drawn toward a pump inlet in a weightless environment by applying a magnetic field. [source]
When placed in the presence of said field, ferrofluids can morph into fascinating shapes like the one seen above. You can learn much more about ferrodluids on Wikipedia where uses of the liquid and how it works get fairly complex and technical.