images – Why does photo quality decrease long after the photo is published?

A photo was posted to my Instagram account, and for about a week it looked clear and the quality was high. However, it suddenly became pixelated to the point of being unrecognizable. I was under the impression that the online images did not change, so I would like to ask what caused this sudden change.
A similar problem has been highlighted with Facebook. I uploaded a photo a few months ago from a Facebook page, and its size was 459 KB. When I downloaded it again this morning, on the same device, the photo was 451 KB.
What causes online photos to deteriorate over time? Is there a way to prevent this?