Geometric phase of entangled spin pairs in a magnetic field