Lady Macbeth goes mad some time between the dinner party where Macbeth sees Banquo's ghost, and her sleepwalking scene. The dinner with all the lords (in act 3, scene 4) is actually the last time that Macbeth and Lady Macbeth appear on stage together, and Lady Macbeth is quite anxious in this scene about her husband's mental state. She feels that he is acting crazily: he is speaking to Banquo's ghost aloud, in front of all their guests, and it sounds to her as though he is addressing a hallucination of Duncan's ghost. Macbeth says to the ghost, "Thou canst not say I did it. Never shake / Thy gory locks at me." Lady Macbeth fears that he is going to give them away as Duncan's murderers (as she does not know yet that Banquo is dead). Her anxiety is so immense that she insults him, asking, "Are you a man?" The implication is that he is not. She scolds him, trying to get him to be quiet. When the lords start to ask him questions, she insists that they leave immediately. In an interesting moment of foreshadowing, Lady Macbeth points out that Macbeth has not slept.
It is ironic that she says this to him because, when we next see her, she has ceased to sleep peacefully too. Lady Macbeth does not reappear until act 5, scene 1, following the murders of Lady Macduff and her children. In this scene, her servant has called a doctor to observe her strange, nocturnal habits. At this point, she seems to be hallucinating, imagining that she cannot wash Duncan's blood off her hands, and she cries, "Out, damned spot! Out, I say!" She also refers to Macduff's dead wife, asking, "What, will these hands ne'er be clean?" I interpret this progression to mean that she now knows that her husband has ordered the deaths of an innocent woman and her children. She has created a monster and Macbeth has gone on to exact greater and crueler violence: first he kills Duncan, then he orders the murders of his best friend and his friend's son, and finally, he kills a good man's family. When she asks if her hands will ever be "clean" again, the implied answer is no. Perhaps she has recognized her role in the deaths of the innocents, and it has driven her mad. At any rate, Lady Macbeth is certainly no longer mentally stable, and, when next we hear of her, she will have taken her own life.