If the image does not show EXIF data, then the software cannot orient it properly.
Use Windows Explorer to modify or remove EXIF data.
Force a preferred orientation.
Rotate the image, then save it.
That process reconstructs the image along the requested dimensions.
That tag, if it’s corrupt or inaccurate, yields improperly rotated images on your system.
FAQ
You might have saved them that way originally.
Another reason has to do with the photo’s EXIF tag.
An incorrect or corrupted tag will tell Facebook to post the photo sideways.
Rotate the photo using Facebook’s editing feature before you finalize your post.
Digital cameras save metadata with each photo in an EXIF tag.
If the tag is corrupted or incorrect, your photo might upload in the wrong orientation.