Its largely to make the weapon concealable.
For shotguns, it also gets rid of the choke that's at the end of the barrel so the pellets have a slightly bigger spread when firing.
Edit: I'm going to be a little pedantic (sorry) and expand this answer:
The reason why you would saw off a shotgun specifically and not a rifle (or even just use a pistol) is because you can't do much forensics with shotgun pellets. The casing doesn't automatically eject (which would leave evidence) and the pellets won't have any unique markings to match them with that specific shotgun. Double-barrel or single-barrel shotguns are relatively cheap so if you had to dispose of them it wasn't a big loss. And then obviously shotguns have devastating results up close - Even if you survive the blast, it would likely be very disfiguring.
Up until the ~30's (in the US) sawed off shotguns were 'legal' as well. The combination of all that made them a good crime weapon and so it was popular to saw off the shotgun barrels.