Taking the decoherence effect due to population relaxation into account, we investigate the entanglement properties for two qubits in the Heisenberg XY interaction and subject to an external magnetic field. It is found that the phenomenon of entanglement sudden death (ESD) as well as sudden birth(ESB) appear during the evolution process for particular initial states. The influence of the external magnetic field and the spin environment on ESD and ESB are addressed in detail. It is shown that the concurrence, a measure of entanglement, can be controlled by tuning the parameters of the spin chain, such as the anisotropic parameter, external magnetic field, and the coupling strength with their environment. In particular, we find that a critical anisotropy constant exists, above which ESB vanishes while ESD appears. It is also notable that stable entanglement, which is independent of different initial states of the qubits, occurs even in the presence of decoherence.