  Fast radio bursts (FRB) will become important cosmological tools, as the
number of observed FRBs is increasing rapidly with more surveys being carried
out. A large sample of FRBs with dispersion measures (DM) and rotation measures
(RM) can be used to study the intergalactic magnetic field. However, the
observed DM and RM of FRBs have multiple contributors which must be quantified
to obtain the intergalactic medium's (IGM) DM and RM. In this paper, we
estimate one such contribution to DM and RM: that of FRB host galaxies. We show
how it changes with redshift, galaxy type, and the stellar mass of the
galaxies, inclination, and FRB's projected offset. Using the IllustrisTNG50
simulations, we selected 16500 galaxies at redshifts of 0<=z<=2, with stellar
masses in the range 9<=log(M*/Msun)<=12. In each galaxy, we calculate the DM
and RM contributions of 1000 sightlines, and construct DM and RM probability
density functions. We find that the rest frame DM distributions of all galaxies
at a given redshift can be fitted by a lognormal function, and the rest frame
RM distribution is symmetric around 0 rad m$^{-2}$, and can be fitted by the
combination of a Lorentzian and two Gaussian functions. The parameters of these
functions change for different subsets of galaxies with different redshift,
stellar mass, inclination, and FRB offset. These changes are due to an
increasing $n_e$ with redshift, SFR, and stellar mass, and we find a more
ordered B field at lower z compared to higher z, suggested by more galaxies
with B field reversals and B fields dominated by random B field at higher z. We
estimate the FRB host DM and RM contributions, which can be used in the future
to isolate the IGM's contribution from the observed DM and RM of FRBs. We
predict that to constrain an $\sigma_{\rm RM,IGM}$ of 2 rad m$^{-2}$ to 95%
confidence level we need to observe 95000 FRBs at z=0.5, but only 9500 FRBs at
z=2.
