We study the time-dependence of the local persistence probability during a non-stationary time evolution in the disordered contact process in d = 1, 2, and 3 dimensions. We present a method for calculating the persistence with the strong-disorder renormalization group (SDRG) technique, which we then apply in the critical point analytically for d = 1 and numerically for d = 2, 3. According to the results, the average persistence decays at late times as an inverse power of the logarithm of time, with a universal, dimension-dependent generalized exponent. For d = 1, the distribution of sample-dependent local persistences is shown to be characterized by a universal limit distribution of effective persistence exponents. By a phenomenological approach of rare-region effects in the active phase, we obtain a non-universal algebraic decay of the average persistence for d = 1, and enhanced power laws for d > 1. As an exception, for randomly diluted lattices, the algebraic decay holds to be valid for d > 1, which is explained by the contribution of dangling ends. Results on the time-dependence of average persistence are confirmed by Monte Carlo simulations. We also prove the equivalence of the persistence with a return probability, a valuable tool for the argumentations.