Some cameras record the orientation of the device when a photo is taken, and add an orientation flag in the file metadata, which software like Photoshop will respect when opening the file. It should (in practice) rotate the image to the correct orientation that the photograph was taken in.
If you don't want that, you can turn off this behaviour in the preferences
There's no equivalent setting in Illustrator, as far as I'm aware. You may have to manually rotate the image if it opens in the wrong orientation.