Water in Star-forming regions with Herschel (WISH) is a Herschel Key Program investigating the water chemistry in young stellar objects (YSOs) during protostellar evolution. Hydroxyl (OH) is one of the reactants in the chemical network most closely linked to the formation and destruction of H2O. High-temperature chemistry connects OH and H2O through the OH + H2 <-> H2O + H reactions. Formation of H2O from OH is efficient in the high-temperature regime found in shocks and the innermost part of protostellar envelopes. Moreover, in the presence of UV photons, OH can be produced from the photo-dissociation of H2O. High-resolution spectroscopy of the OH 163.12 micron triplet towards HH 46 and NGC 1333 IRAS 2A was carried out with the Heterodyne Instrument for the Far Infrared (HIFI) on board Herschel. The low- and intermediate-mass YSOs HH 46, TMR 1, IRAS 15398-3359, DK Cha, NGC 7129 FIRS 2, and NGC 1333 IRAS 2A were observed with the Photodetector Array Camera and Spectrometer (PACS) in four transitions of OH and two [OI] lines. The OH transitions at 79, 84, 119, and 163 micron and [OI] emission at 63 and 145 micron were detected with PACS towards the class I low-mass YSOs as well as the intermediate-mass and class I Herbig Ae sources. No OH emission was detected from the class 0 YSO NGC 1333 IRAS 2A, though the 119 micron was detected in absorption. With HIFI, the 163.12 micron was not detected from HH 46 and only tentatively detected from NGC 1333 IRAS 2A. The combination of the PACS and HIFI results for HH 46 constrains the line width (FWHM > 11 km/s) and indicates that the OH emission likely originates from shocked gas. This scenario is supported by trends of the OH flux increasing with the [OI] flux and the bolometric luminosity. Similar OH line ratios for most sources suggest that OH has comparable excitation temperatures despite the different physical properties of the sources.