We extend recently developed methods used for determining the electromagnetic charge radius and ${a}_{\ensuremath{\mu}}^{\ensuremath{\pi}\ensuremath{\pi}}$ to obtain a determination of the electromagnetic form factor of the pion, ${F}_{\ensuremath{\pi}}^{V}(t)$, in several significant kinematical regions, using a parametrization-free formalism based on analyticity and unitarity, with the inclusion of precise inputs from both timelike and spacelike regions. On the unitarity cut, below the first inelastic threshold, we use the precisely known phase of the form factor, known from $\ensuremath{\pi}\ensuremath{\pi}$ elastic scattering via the Fermi-Watson theorem, and above the inelastic threshold, a conservative integral condition on the modulus. We also use as input the experimental values of the modulus at several energies in the elastic region, where the data from ${e}^{+}{e}^{\ensuremath{-}}\ensuremath{\rightarrow}{\ensuremath{\pi}}^{+}{\ensuremath{\pi}}^{\ensuremath{-}}$ and $\ensuremath{\tau}$ hadronic decays are mutually consistent, as well as the most recent measurements at spacelike momenta. The experimental uncertainties are implemented by Monte Carlo simulations. At spacelike values ${Q}^{2}=\ensuremath{-}t>0$ near the origin, our predictions are consistent and significantly more precise than the recent QCD lattice calculations. The determinations at larger ${Q}^{2}$ confirm the late onset of perturbative QCD for exclusive quantities. From the predictions of $|{F}_{\ensuremath{\pi}}^{V}(t){|}^{2}$ on the timelike axis below 0.63 GeV, we obtain the hadronic vacuum polarization (HPV) contribution to the muon anomaly, ${a}_{\ensuremath{\mu}}^{\ensuremath{\pi}\ensuremath{\pi}}{|}_{\ensuremath{\le}0.63\text{ }\text{ }\mathrm{GeV}}=(132.97\ifmmode\pm\else\textpm\fi{}0.70)\ifmmode\times\else\texttimes\fi{}{10}^{\ensuremath{-}10}$, using input from both ${e}^{+}{e}^{\ensuremath{-}}$ annihilation and $\ensuremath{\tau}$ decay, and ${a}_{\ensuremath{\mu}}^{\ensuremath{\pi}\ensuremath{\pi}}{|}_{\ensuremath{\le}0.63\text{ }\text{ }\mathrm{GeV}}=(132.91\ifmmode\pm\else\textpm\fi{}0.76)\ifmmode\times\else\texttimes\fi{}{10}^{\ensuremath{-}10}$ using only ${e}^{+}{e}^{\ensuremath{-}}$ input. Our determinations can be readily extended to obtain such contributions in any interval of interest lying between $2{m}_{\ensuremath{\pi}}$ and 0.63 GeV.