Based on the theory of the chemical reaction and the Tixier Model, we established a time-varying function of the porosity of concrete. The function, which has taken the filling effect of the ettringite to the capillary porosity into consideration, can obtain the change of the porosity at different stages of the corrosion subjected to external sulfate attack. Numerical simulation is utilized to analyze the distribution of porosity and sulfate ion concentration inside the concrete at different moment of the corrosion.