The device you are using captures the image and also includes EXIF data in the photo.
EXIF stands for Exchangeable Image File Format. Every time you take a picture with your digital camera or phone, a file (usually a JPEG) is recorded to your device’s storage. Besides the picture itself, it also records a considerable amount of supplemental metadata as well. This can include date, time, camera settings, and even possible copyright information. You can also add or further modify metadata to EXIF, with additional software. In fact, if you use a camera phone or digital camera with GPS capabilities, it will usually record EXIF geolocation metadata (the GPS coordinates of where you were standing when you took the picture). This could be seen as good or bad, depending on how you feel about privacy.
Unfortunately, some of the things it records to the file may not make sense to us, such as how you were holding the camera, and on some devices this can even depend on which button you pushed when you took the picture (did you tap the screen, did you push the Home button on the face of the phone, did you use one of the phone's side buttons (volume / Power, etc...), it may appear upright to you, but upside-down to the internet and other places where EXIF data is not used. Many internet locations (facebook, most software forums, etc..) will strip out the EXIF data and post the picture as it sees it, not as the EXIF data says it was taken. The result on our forum is usually upside-down or sideways pictures.
When this happens, you can simply open the .jpg image with a simple photo editor (i use MSPaint that comes with Windows), rotate the picture to the correct layout and save it right back over the existing file. Then post that file. Yes, it's a pain... but until everyone gets on board with supporting EXIF data (there are some advantages), this can and will be a problem.
Hope this helps some to understand.
Just my $.02.
2013 Honda F6B
2003 Honda ST1100P
2008 Honda Nighthawk 250 (Teaching my daughter to ride).