Claudius had murdered Hamlet’s father, ascended the throne and married Hamlet’s mother Gertrude. Hamlet suspects Claudius and is urged by his dead father’s ghost to avenge him. The ghost singles out Claudius as the murderer. Hamlet feigns madness as part of his scheme to avenge his father but instead kills Polonius, Laertes and Ophelia’s father. The death of Polonius was an accident since Hamlet meant to kill Claudius. The phrase “And where the offence is let the great axe fall” develops the plot and shows conflict between the characters, because Claudius knows Hamlet wants to kill him, but he also knows that Hamlet killed Polonius and to save his own life he would rather allow Laertes to avenge his father by killing Hamlet. This does not happen and instead Hamlet kills Claudius and takes revenge for both his father and mother. In the end the “Great axe falls” on both Claudius and Hamlet (who in essence is killed by Claudius through Laertes) and the phrase supports the theme of revenge that is dominant throughout the play.
In this scene (Act IV, Scene v), Laertes demands to know who is responsible for his father's, Polonius', death. By this time, Ophelia is completely mad as a result of her despair from her father's death and Hamlet's mistreatment of her. Unlike Hamlet who delays, Laertes rushes in ready to take revenge on Claudius. But, ever the manipulator, Claudius convinces Laertes that he is not responsible for Polonius' death. Laertes agrees to be patient and see how things play out, but he plans to at least find out why Polonius was buried so quickly and without proper ritual. Claudius acknowledges what Laertes plans to do and notes that "the great axe" will fall on the one who is responsible for the death of Polonius.
This foreshadows the duel between Hamlet and Laertes. It is also ironic that Claudius speaks these lines because the axe or sword will eventually fall on himself for his own offence of killing the king. In a larger perspective, Hamletis about the state of Denmark, which is initially "rotten," in the political and spiritual sense. If those who've committed offences are met with justice, perhaps Denmark will return to a peaceful, ordered state.
Claudius utters these lines in response to Laertes' absolutely justified anger at both his father's death as well as the way it seems to have been hushed up by the Danish court, implying that something about the death is suspect. In addition to wanting to know who is responsible for the death, his father, Polonius, Laertes believes, was not afforded the respect, in terms of his funeral service, that he deserves. Thus, the line helps to develop plot because it foreshadows the events to come: Claudius will seem to help Laertes avenge his father's death out of his own sense of justice (which we know is not why he will help -- he will do so because he wants to get rid of Hamlet, and, in this way, the line helps to develop the conflict between the two of them as well).
Further, the line helps to develop the themes of revenge and justice, too. Both Hamlet and Claudius are guilty of grave offenses now, and this line speaks to the need for justice for them both if the court of Denmark is to be restored to a time before "something rotten" began to eat away at its heart. It cannot be healthy unless and until justice is brought to bear on them both, as well as everyone else who has contributed to the rot (i.e. Gertrude and Laertes, eventually).