The BaFe2(As1-xPx)2 compounds with x=0 (parent), x=0.10 (underdoped), x=0.31, 0.33, 0.53 (superconductors with Tc=27.3, 27.6, 13.9 K, respectively), and x=0.70, 0.77 (overdoped) have been investigated versus temperature using Fe57 Mössbauer spectroscopy. Special attention was paid to regions of the spin-density wave (SDW) antiferromagnetic order, spin-nematic phase, and superconducting transition. The BaFe2(As0.90P0.10)2 compound exhibits a reduced amplitude of SDW as compared to the parent compound and preserved universality class of two-dimensional magnetic planes with one-dimensional spins. The spin-nematic phase region for x=0.10 is characterized by an incoherent magnetic order. BaFe2(As0.69P0.31)2 shows coexistence of a weak magnetic order and superconductivity due to the vicinity of the quantum critical point. The charge-density modulations in the BaFe2(As0.67P0.33)2 and BaFe2(As0.47P0.53)2 superconductors are perturbed near Tc. Pronounced hump of the average quadrupole splitting across superconducting transition is observed for the system with x=0.33. The phosphorus substitution increases the Debye temperature of the BaFe2(As1-xPx)2 compound. Moreover, experimental electron charge densities at Fe nuclei in this material conclusively show that it should be recognized as a hole-doped system. The measured Mössbauer spectral shift and spectral area are not affected by transition to the superconducting state. This indicates that neither the average electron density at Fe nuclei nor the dynamical properties of the Fe sublattice in BaFe2(As1-xPx)2 are sensitive to the superconducting transition. Theoretical calculations of hyperfine parameters determining the patterns of Mössbauer spectra of BaFe2(As1-xPx)2 with x=0, 0.31, 0.5, and 1.0 are performed within the framework of the density-functional theory. These simulations provide an insight into changes of the immediate neighborhood experienced by Fe atoms upon the P for As substitution as well as enable us to explore influence of P doping on the electron density, electric field gradient, and hyperfine field at Fe nuclei in the BaFe2(As1-xPx)2 system.