We review the measurements of magnetic fields of OBA stars. Based on these data we confirm that magnetic fields are distributed according to a lognormal law with a mean log(B)=-0.5 (B in kG) with a standard deviation sigma=0.5. The shape of the magnetic field distribution is similar to that for neutron stars. This finding is in favor of the hypothesis that the magnetic field of a neutron star is determined mainly by the magnetic field of its predecessor, the massive OB star. Further, we model the evolution of an ensemble of magnetic massive stars in the Galaxy. We use our own population synthesis code to obtain the distribution of stellar radii, ages, masses, temperatures, effective magnetic fields and magnetic fluxes from the pre-main sequence (PMS) via zero age main sequence (ZAMS) up to the terminal age main sequence (TAMS) stages. A comparison of the obtained in our model magnetic field distribution (MFD) with that obtained from the recent measurements of the stellar magnetic field allows us to conclude that the evolution of magnetic fields of massive stars is slow if not absent. The shape of the real MFD shows no indications of the magnetic desert proposed previously. Based on this finding we argue that the observed fraction of magnetic stars is determined by physical conditions at the PMS stage of stellar evolution.