  We theoretically study the indirect interaction between two ferromagnetic
contacts located on the surface of a $d$-wave superconductor. When the magnets
are connect to a $\{010\}$ edge of the superconductor we find a damped RKKY
interaction that is quickly reduced as the distance between the magnetic
contacts is increased. However, when coupling the magnets to an $\{110\}$ edge
of the superconductor, we find that the presence of midgap states qualitatively
changes the results. The ground state of the system is then found to always
favor alignment of the magnets as this configuration most strongly suppresses
the midgap states, leading to a larger condensation energy which dominates over
the intrinsic RKKY interaction.
