What was the purpose of the messenger in Act IV, Scene 2 of Macbeth? Who sent the messenger?
The purpose of the messenger is to add suspense. He seems to have sent himself.
We really do not know much about the messenger, but his timing sucks. A suspicious person might say he was there to distract Lady Macduff for the murderers, because he literally walks in, walks out, and the murderers come in. Even if they had wanted to run, the Macduff family had no time to do so.
Conspiracy theories aside, let’s pretend the messenger is exactly who he says he is: a humble subject of Macbeth’s who hears Lady Macduff is in danger and wants to warn her. He seems to know Macbeth's plans, because the messenger warns Lady Macduff to take her children, too.
Bless you, fair dame! I am not to you known,
Though in your state of honour I am perfect.
I doubt some danger does approach you nearly:
If you will take a homely man's advice,
Be not found here; hence, with your little ones. (Act IV, Scene 2)
The messenger wasn’t sent by anyone in particular. He came on his own. The messenger repeatedly tells Lady Macduff he is humble, but honorable, meaning she should trust him. He also tells her that she doesn’t know him. He basically tells her that he is below her. He also leaves just in time; the the murderers arrive right after he exits.
Lady Macduff refuses to leave.
Whither should I fly?
I have done no harm. But I remember now
I am in this earthly world; where to do harm
Is often laudable, to do good sometime
Accounted dangerous folly: why then, alas,
Do I put up that womanly defence,
To say I have done no harm (Act IV, Scene 2)?
The Macduffs are a brave family. Lady Macduff doesn’t want to be pushed out of her own house, and who can blame her? She really has no chance, though, and she realizes that. The murderers enter, tell Lady Macduff her husband is a traitor, and kill her and her children.
One way or another, what the messenger does accomplish is adding suspense. When he enters, the audience (or readers) know something exciting is about to happen.