First principles calculations by using of projected augmented plane-wave method have been performed to investigate the structural, elastic and electronic properties of MgB2C2 under different pressures. The results indicate that the ternary compound of MgB2C2 remains mechanically stable under pressure ranging from 0 to 50 GPa. Elastic analysis is performed and it is found that MgB2C2 always shows obvious intrinsic brittleness under pressure, although an increasing trend of the ductility both from BH/GH and vH with increasing pressure. (100), (010) and (1-10) planes show strong anisotropy and the degree of anisotropy decreases with increasing pressure, in the meantime, it is interesting to find that the degree of anisotropy is reduced in order of planes (1-10)-(100)-(010) under the same pressure.