Abstract The hazard rate function is always applied to make maintenance policy, and the usual hazard rate function is computed by the data of failure times of systems working in constant environment, thus for systems working in dynamic environment it cannot be directly applied. In this paper, hazard rate function of system in the dynamic environment is computed, and the effects of current environment status and the environmental history on hazard rate function are explicitly presented. For system with the known degradation process, hazard rate function is studied by the Markov additive process. The environment evolution process is modeled as a stochastic process with two states, one state represents normal environment, the other represents severe environment, and system degrades more quickly under severe environment than under normal environment. The relationship between hazard rate functions of system in time-invariant and dynamic environment is researched, from which three important facts are revealed, firstly hazard rate function jumps as the environment jumps, secondly the form of hazard rate function is determined Wby current environment state, and thirdly the effective age of system is determined by the environmental history. For system with the unknown degradation process, based on the above facts, this paper derives the hazard rate function in dynamic environment, and proposes a method to compute the effective age under given environmental history. Finally the optimal maintenance policy for system in dynamic environment is studied.