In Act 5, Scene 1, a Doctor (not the king) and a Gentlewoman observe Lady Macbeth's sleepwalking. They witness her compulsive hand-washing and fragmented confessions of guilt over Duncan's murder—revealing her psychological unraveling.
Lady Macbeth's sleepwalking is the body's rebellion against the mind's repression. The Doctor and Gentlewoman are the audience within the play—watching, helpless, confirming what Macbeth refuses to see.