Using first-principles electronic structure calculations we identify the anion vacancies in II-VI and chalcopyrite Cu-III-VI2 semiconductors as a class of intrinsic defects that can exhibit metastable behavior. Specifically, we predict persistent electron photoconductivity (n-type PPC) caused by the oxygen vacancy VO in n-ZnO, and persistent hole photoconductivity (p-type PPC) caused by the Se vacancy VSe in p-CuInSe2 and p-CuGaSe2. We find that VSe in the chalcopyrite materials is amphoteric having two negative-U like transitions, i.e. a double-donor transition e(2+/0) close to the valence band and a double-acceptor transition e(0/2-) closer to the conduction band. We introduce a classification scheme that distinguishes two types of defects (e.g., donors): type-alpha, which have a defect-localized-state (DLS) in the gap, and type-beta, which have a resonant DLS within the host bands (e.g., conduction band). In the latter case, the introduced carriers (e.g., electrons) relax to the band edge where they can occupy a perturbed-host-state (PHS). Type alpha is non-conducting, whereas type beta is conducting. We identify the neutral anion vacancy as type-alpha and the doubly positively charged vacancy as type-beta. We suggest that illumination changes the charge state of the anion vacancy and leads to a crossover between alpha- and beta-type behavior, resulting in metastability and PPC. In CuInSe2, the metastable behavior of VSe is carried over to the (VSe-VCu) complex, which we identify as the physical origin of PPC observed experimentally. We explain previous puzzling experimental results in ZnO and CuInSe2 in the light of this model.