I've seen it happen to almost all my phones that've lived in my pockets. I'm not sure it's entirely avoidable, given the space between the glass and lens. Use to see it quite often on the screens of phones as well, until OEMs started using the newer technology where the display was fused to the glass, eliminating the space between them. You can however take steps to minimize or prevent it from happening - wash your pants with the pockets turned inside out, or put your phone in a phone pouch before throwing in your pocket.
Sent from my iPad using Tapatalk