The magnetic field of the magnet exerts force on both the poles of the compass needle. The forces experienced by the two poles are equal and opposite. These two forces form a couple which deflects the compass needle.