Since casting magnesium alloys contain numerous spherical microvoids, the aggregate of microvoids and matrix can be analyzed using a representative volume element. The representative element can be idealized as a cell containing a spherical void. Through the analysis on the velocity field of the spherical void-cell model, the strain field of the spherical void-cell model was obtained. Defining an intrinsic time that involves the hardening due to plastic deformation and the softening due to voids, a new endochronic model was derived for the elastoplastic and damage behavior of casting magnesium alloys. The corresponding numerical algorithm and finite element procedure were developed and applied to the analysis of the elastoplastic response and the porosity of casting magnesium alloy ZL101. The computed results show satisfactory agreement with experiments.