Organelles are sub-cellular compartments in cells. However prokaryotes don't use organelles to organise their intracellular space.
Evolutionarily, there is evidence that mitochondria and chloroplasts are ancestors of symbiotic prokaryotes. This theory is called the endosymbiotic theory.
I've tried to find an evolutionary story that explains other organelles, specifically the endoplasmic reticulum. There is plenty of literature about biogenesis of these organelles, but nothing about the history of their evolution. I don't think I have found the right area of literature. What did organelles originate from? I'm happy just to know a few keywords or a citation to look it up myself.