Calculated elastic and electronic properties of MgB2 at high pressures