The exact explanation of the origin of magnetic field of the Earth and other planets does not yet exist. There are several hypotheses, theories and experiments, trying to find a solution to this problem, but the final, rigorous proof of these hypotheses does not exist. This article discusses the hypothesis that the main reason for the emergence and maintenance of the magnetic field is the ionosphere, containing the charges, which are recharged by the solar wind. This approach allowed us to explain a number of observed phenomena, including the inversion of the magnetic field of the Earth and planets. On the basis of these estimates the calculations of magnetic fields of other planets were carried out and demonstrated good agreement with measurements. There was a number of assessments carried out, which showed the correctness of this approach.