There's a couple of different types, and oil can cause problems in both.
First type is pre-ignition, where something, usually a hot spot causes the gasses to ignite before the spark starts. Oil leakage can lead to ash deposits that can be the ignition source here.
The other type is classic "detonation", which is technically "end gas auto-ignition". The gasses away from the spark plug are heated and compressed by the combustion behind them (the pressure and heat of compression travels at the speed of sound, while the flame travels at less than 100fps).
The gasses get hot enough and bang, there are two competing and colliding flame fronts.
Oil in the end gas region makes it more likely to happen, as do ash deposits where the oil has been.
As per other posts, lack of EGR can do it too, but EGR is usually a part throttle thing rather than reasonable acceleration.