  Magnetic field of rotating pulsar might be so strong that the equation of
state (EOS) of neutron star (NS) matter is significantly affected by the spin
polarization of baryons. In the present work, the EOS of the spin-polarized
nuclear matter is investigated in the nonrelativistic Hartree-Fock formalism,
using a realistic density dependent nucleon-nucleon interaction with its spin
and spin-isospin dependence accurately adjusted to the Brueckner-Hartree-Fock
results for the spin-polarized nuclear matter. The nuclear symmetry energy and
proton fraction are found to increase significantly with the increasing spin
polarization of baryons, leading to a larger probability of the direct Urca
process in the cooling of magnetar. The EOS of the $\beta$-stable np$e\mu$
matter obtained at different spin polarizations of baryons is used as the input
for the Tolman-Oppenheimer-Volkov equations to determine the hydrostatic
configuration of NS. Based on the GW170817 constraint on the radius $R_{1.4}$
of NS with $M\approx 1.4_\odot$, our mean-field results show that up to $60~\%$
of baryons in the NS merger might be spin-polarized. This result supports the
magnetar origin of the blue kilonova ejecta of GW170817 suggested by Metzger et
al., and the spin polarization of baryons needs, therefore, to be properly
treated in the many-body calculation of the EOS of NS matter before comparing
the calculated NS mass and radius with those constrained by the multi-messenger
GW170817 observation.
