We have developed the potential parameters for the simulation of MgB2 and calculated the variations of lattice parameters and volume with pressure up to 240 GPa. Our calculated results are in good agreement with experimental results below 40 GPa. By employing the McMillan expression, it is found that the lattice stiffening dominates the behaviour of the superconducting transition Tc under pressure in the scope of BCS theory. Using our calculated Grüneisen parameter ggrG, the simulated pressure effect on Tc accords well with experimental results. Our result shows that the Tc of MgB2 can be destroyed by high pressure.