Fiction produced is very often a reaction to something the author sees as a problem in one way or another. In some societies, it is not safe to directly criticize what is going on, and in others it just may be more effective to do it in an oblique way. Think of Arthur Miller's The Crucible. There were many people opposed to Joe McCarthy's politics of guilt by nebulous association, but Miller managed to make his opposition crystal clear by comparing it to the Salem witch trials. The relationship is not always to some direct event--Shirley Jackson's "The Lottery" condemns a more general attitude of "we do it this way because we always have...we don't need to think about it." Animal Farm and 1984 take on big issues of political/governmental systems, as does Fahrenheit 451.
Sometimes it is more effective to be indirect in your criticisms. In some societies, it is also much safer. Look at what happened to Salman Rushdie when he published a work of fiction.