The ever-increasing complexity of environmental pollutants urgently warrants the development of new detection technologies. In this context, sensors based on the optical properties of hydrogels enabling fast and easy in situ detection are attracting increasing attention. Herein, the target recognition and sensing mechanisms of two main types of optical hydrogels (OHs) are reviewed and discussed: photonic crystal hydrogels (PCHs) and fluorescent hydrogels (FHs). For PCHs, the environmental stimulus response, target receptors, inverse opal structures, and molecular imprinting techniques related to PCHs are reviewed and summarized. Furthermore, the different types of fluorophores (i.e., compound probes, biomacromolecules, quantum dots, and luminescent microbes) of FHs are summarized. Finally, the data from 138 papers about different OHs are extracted for secondary statistical analysis. The detection performance and potential of various OH types in different environmental pollutant detection scenarios are evaluated, and compared them to those obtained using the standard detection method. Based on this analysis, some possible development directions are proposed, including the fusion of various OHs, introduction of more hydrogel technologies from the biomedical field to the environmental pollutant detection field, and development of multifunctional sensor arrays.