MP2/6-31G*//6-31G* ab initio quantum chemical calculations in the gas phase and Monte Carlo simulations for isothermal-isobaric (NPT) ensembles in aqueous solution have been carried out for 2- and 4-hydroxybenzoic acid. After total geometry optimization of eight planar conformers for the 2-OH derivative and four conformers for the 4-OH derivative in the gas phase, the structure with the 2-OH phenolic hydroxyl with an intramolecular hydrogen bond to the carbonyl oxygen was found to be the most stable conformer. Normal frequency analyses were carried out using the 6-3 1 G* optimized geometries, and thermal corrections were obtained at 298 K and 1 atm. Structures for the 2-OH isomer, with the carboxylic hydrogen trans to the carbonyl oxygen or without intramolecular hydrogen bonds, are higher in free energy by at least 8 kcal/mol. The most stable 4-OH isomer with the cis carboxylic hydrogen is higher in free energy by 4.4 kcal/mol than the most stable 2-OH isomer. Relative hydration free energies, using the statistical perturbation method, were calculated for three conformers of 2-hydroxybenzoic acid with and without intramolecular hydrogen bonds. Hydration prefers the internally less stable forms by 1.5-5.5 kcal/mol. In total, however, the conformer most stable in the gas phase remains the dominant conformer also in the aqueous solution. Solution structure simulations emphasize the importance of water-solute hydrogen bond formation. The 4-hydroxybenzoic acid solute forms four to five hydrogen bonds with the surrounding water molecules. This value is two to four for the 2-OH isomers depending on the number of the intramolecular hydrogen bonds. Solute-water hydrogen bonds are shorter and more localized with acceptor rather than with donor water molecules. The water molecules around the nonpolar part of the solute are located at a distance of 3-4 angstrom from the ring atoms. Calculated hydrogen bond geometries were compared with experimental values referred to the crystalline phase and available in the literature. Intermolecular hydrogen bonds with water in solution exhibit geometries similar to those in the crystalline phase. These hydrogen bonds are slightly bent in contrast to the intramolecular hydrogen bonds in the 2-OH derivative, in both the gas and the crystalline phases.