In those earlier machines, a 'drum' made out of a special material is given an electrostatic charge across its surface. The image to be copied is shone onto the drum, knocking the electrons off where the light shines; very fine solid ink particles ('toner') will then adhere to the places on the drum which have retained their charge. A heated roller then melts the ink particles onto the paper.
This process was adapted to printing by replacing the bright illumination of the original image, as a source of light onto the drum, with a laser beam (chosen as a source since they can produced very precise and intense light beams, which can be turned off and on very quickly). The laser beam is scanned across the drum in a raster process.