In-situ pyrolysis of tar-rich coal is a potentially green and low-carbon development technology. However, there are restrictions on the transport of tar and gas products due to the evolution of pore structure during pyrolysis. Hence, revealing the evolution of pore structure during pyrolysis is helpful to understand this restraining behavior. In this work, both the open and closed mesopores inside coal with thermal treatment were investigated by low-temperature nitrogen adsorption and small angle X-ray scattering, and the molecular structure under corresponding conditions was characterized using Fourier transform infrared spectroscopy, 13C nuclear magnetic resonance, and X-ray diffraction. The results showed that the evolution of open mesopores with temperature exhibited a trend of decreasing and subsequently increasing, which was consistent with closed mesopores. These evolutions were affected by the adjustment of molecular structure during pyrolysis, and the effect was specifically divided in two stages. In the first stage (<500 °C), molecular structures such as aliphatic and oxygen were continuously removed affected by the decomposition reaction, resulting in a drastic reduction of the mesopores. In the second stage (>500 °C), molecular structure dominated by aromatic structures were continuously condensed under the influence of polycondensation reaction, leading to a gradual increase in mesopores.