Premature cervical remodeling is an indicator of impending spontaneous preterm birth, however, current clinical measurements of cervical remodeling are mainly obtained by digital examinations, which are subjective and detect only late events, such as cervical effacement and dilation. The incompletely understood mechanisms of cervical remodeling lead to degradation of extracellular matrix proteins and inflammation, and these physiological changes are associated with increased tissue hydration. Near-infrared spectroscopy is routinely used in industrial applications to quantify the water content in various products, because this method does not require sample preparation and is nondestructive. Spectroscopic photoacoustic tomography is an embodiment of near-infrared spectroscopy and has been demonstrated in the quantification of various biochemical constituents. However, the dimensions of those tabletop systems in the previous demonstrations preclude in vivo use in the gastrointestinal tract and urogenital tract. Photoacoustic endoscopy (PAE) incorporates an acoustic detector, optical components, and electronic components in a millimeter-diameter-scale probe to image tissue that is inaccessible by the tabletop systems. Here, we present a near-infrared spectroscopic PAE system. We analyze the measured photoacoustic near-infrared (PANIR) spectra by linear regression. We demonstrate that this method successfully quantifies the water contents of tissue-mimicking phantoms made of gelatin hydrogel. Applying this method to the cervices of pregnant women, we observe their physiological water contents and a progressive increase throughout gestation. The application of this technique in maternal health care may advance our understanding of cervical remodeling and provide a sensitive method for predicting preterm birth.