The intramolecular proton-transfer reaction of 8-hydroxyimidazo[1,2-a]pyridine (HIP) is studied in both the ground (S0) and first singlet excited (S1) electronic states. Ab initio calculations at the HF/MP2 and CIS/MP2 levels, respectively for S0 and S1, reveal the existence of two tautomers. In gas phase the enol (E) form is the more stable one in S0, whereas in S1 the zwitterionic (Z) tautomer becomes the lowest in energy. The energy barrier for the proton-transfer process is quite high in both electronic states. Introduction of one water molecule in the system greatly changes the picture of the whole process. A 1:1 complex involving two hydrogen bonds between HIP and water is formed. The H-bond bridge greatly facilitates the proton transfer in both S0 and S1 states. Additionally, for the two considered electronic states the Z structure is more stabilized than the E one. The trends of lowering the energy barrier and stabilizing the Z structure with respect to E are more prominent when the bulk effect of the solvent is introduced through a continuum (i.e. cavity) model. The energy profiles obtained for both S0 and S1 allow prediction of the electronic spectra of HIP in different media.