Hemiacetals and hemiketals may be thought of as intermediates in the reaction between alcohols and aldehydes or ketones, with the final product being an acetal or a ketal:
:RC=O + ROH ⇌ RC(OH)(OR)
:RC(OH)(OR) + ROH ⇌ RC(OR') + HO
Usually, the second reaction is unfavorable.  In the presence of a dehydrating agent, it proceeds.