I have a photo in Photoshop that I cropped out of its background. When I save the file as a PSD and import the file in InDesign, then save the InDesign file as a JPG, I get a pixel line around the image.
You cropped mid-pixel. Photoshop either has to use that last pixel or not. You left more than 50% of the pixel, so Photoshop includes it. You cropped poorly.
It might help to turn on the pixel grid (View menu) and then zoom in when you crop to ensure you crop at whole pixels.
jpg in inDesign I won't comment on, but if the image started as a jpg, you really should never then save it as a jpg.
I would go back to photoshop and reselect your masked area or the photo
then go to Select - Modify - Expand (if you've selected the background) or Select - Modify - Contract (if you've selected the photo). Set the modification to 2px
then go to Select - Modify - Feather and set that to 1px.
Hope that works for you.