The asymptotic shape theorem for the contact process in random environment gives the existence of a norm . on Rd such that the hitting time t(x) is asymptotically equivalent to .(x) when the contact process survives. We provide here exponential upper bounds for the probability of the event {t(x).(x).[1..,1+.]}; these bounds are optimal for independent random environment. As a special case, this gives the large deviation inequality for the contact process in a deterministic environment, which, as far as we know, has not been established yet.