The Sun's magnetic field reverses polarity approximately every 11 years, defining the solar cycle. This results from the dynamics of the solar dynamo. A similar process causes Earth's magnetic field to reverse over much longer timescales. Therefore the magnetic moment of the Sun and Earth do not maintain a fixed orientation with respect to one another. They do tend to be parallel or antiparallel to the bodies' axes of rotation, though.
It's worth noting that the Sun's magnetic field deviates significantly from a simple magnetic dipole. "Open" magnetic field lines of opposite polarity are separated by the heliospheric current sheet, which rotates with the sun ($\approx27$ day period). The planets regularly pass through this current sheet. Thus the solar magnetic field does not have a consistent direction with respect to Earth, even on timescales shorter than the solar cycle.
![Heliospheric magnetic field](https://cdn.statically.io/img/i.sstatic.net/7NyT3.gif)
Solar wind plasma carries a frozen in magnetic field with it. This is not necessarily aligned with the Sun's overall magnetic moment. However, the alignment of the solar wind with Earth's magnetic moment does determine how it impacts the geomagnetic field. Strong geomagnetic storms tend to be triggered by coronal mass ejections with magnetic field of opposite alignment to Earth's.