The magnetic hyperfine (MHF) structure of the $5/2^+$(0.0 eV) ground state and the low-lying $3/2^+$(7.8 eV) isomeric state of the $^{229}$Th nucleus in highly charged ions Th$^{89+}$ and Th$^{87+}$ is calculated. The distribution of the nuclear magnetization (the Bohr-Weisskopf effect) is accounted for in the framework of the collective nuclear model with the wave functions of the Nilsson model for the unpaired neutron. The deviations of the MHF structure for the ground and isomeric states from their values in the model of point-like nuclear magnetic dipole are calculated. The influence of the mixing of the states with the same quantum number $F$ on the energy of sublevels is studied. Taking into account the mixing of states, the probabilities of the transitions between the components of MHF structure are found.