Your answer is right.
First of all organic matter (organisms) sink to the bottom of an ancient ocean and mix with the inorganic. This cretes an organic-rich mud that can only form in still water enviroments. This mud cannot be exposed to too much oxygen.
If this shale is buried some kilometres, its temperature increases due to the location in the Earths interior. This increasing pressure and temperature transforms it into oil.
If the organic material is recycled by microorganisms, this process cannot occur.