We performed first-principles calculations of the structural, electronic, and optical properties of heterostructures which consist of transition metal dichalcogenides MX2 (M = Mo, W; X = S) stacked with Mg(OH)2. All the heterostructures are formed by van der Waals forces. The MoS2/Mg(OH)2 and WS2/Mg(OH)2 vdW heterostructures were found to be semiconductors with indirect bandgaps and possess intrinsic type-II band alignment. In particular, a comparison of the band edge positions with the redox potential of water indicates that the heterostructures are potential photocatalysts for water splitting, enabling water reduction on the MX2 layer and water oxidation on the Mg(OH)2 layer. Moreover, the photogenerated charges will be effectively separated in the presence of a large built-in electric field across the interface. In addition, all of the MX2/Mg(OH)2 heterostructures show strong optical absorption in the visible and infrared regions, indicating their promise for application in photocatalytic water splitting.