Magnesium phosphate cement (MPC) paste is hardened by the acid–base reaction between magnesium oxide and phosphate. This work collects and evaluates the thermodynamic data at 25 °C and a pressure of 0.1 MPa and establishes the hydration reaction model of MPC pastes. The influence of the magnesium–phosphorus molar (M/P) ratio and water-to-binder (W/B) ratio on the hydration product is explored by the thermodynamic simulation. Following this, the initial and ultimate states of the hydration state of MPC pastes are visualized, and the porosity of different pastes as well as fractal analysis are presented. The result shows that a small M/P ratio is beneficial for the formation of main hydration products. The boric acid acts as a retarder, has a significant effect on lowering the pH of the paste, and slows down the formation of hydration products. After the porosity comparison, it can be concluded that the decreasing of M/P and W/B ratios helps reduce porosity. In addition, the fractal dimension Df of MPC pastes is positively proportional to the porosity, and small M/P ratios as well as small W/B ratios are beneficial for reducing the Df of MKPC pastes.