WHEN:
In Metal Gear Solid 1, Revolver Ocelots hand was cut off by a cyborg ninja (Grey Fox), while fighting with Solid Snake. After the incident of Shadow Moses, Ocelot got hold of Liquids body (or at least his arm), which he used to replace his arm.
HOW:
This is not explained in Metal Gear Solid 2, but in Metal Gear Solid 4: Guns of the Patriots. I could write up what happened, but the Wiki explains it quite nicely:
Big Boss later revealed to Snake that Liquid "possessing" Ocelot was a planned ruse in order to fool the Patriots as means of lowering The Patriots' guard against him. Big Boss elaborated that Ocelot was able to use hypnosis, drugs, psychotherapy and nanomachines to transplant the personality of Liquid Snake onto himself.