A car engine is nothing but a combustion engine which contains a series of small explosions. Now these explosions are supposed to take place inside the combustion chamber, but when this doesn't happen we hear a loud noise or bang which is termed as backfire. This can typically occur in the intake valve area and also in the exhaust system.
Causes may be related to low fuel pressure which causes backfire in the exhaust system. The air to fuel ratio is altered and fuel starts collecting in the exhaust manifold where it can accumalate and even a slight spark can cause it to ignite leading to backfire.
Engine timing going haywire can also cause backfire because it alters the sparking schedule of the engine leading to backfire again.