The first part of the reaction mechanism consists of an ordinary nucleophilic aliphatic substitution  to produce a gem-halohydrin:
: RCH(Cl) + KOH  RCH(OH)Cl + KCl
The remaining halide is a good leaving group and this enables the newly created hydroxy group to convert into a carbonyl group by expelling the halide:
:RCH(OH)Cl   Rearrangement gives R-CHO + HCl