I'm assuming there is some sophisticated imaging software and hardware built into the gun, and the bullet has a chip inside? Ima read up on it cause now I'm curious.
edit:
That's how it works. Optical sensor on the bullets tip, follows the laser trained on the target.
read the article. At the tip is an optical sensor, that can detect a laser beam being shone on a far-off target.
This is technically a small-weight A-10 Guided Missile or Javelin for instance...and possibly costly enough not to be fielded by every soldier.