Historic background

(1) It was written in 1605 or 1606, right after James I, the first Stuart king, took up the crown of England in 1603. James I was the son of Mary, Queen of Scots (cousin to Elizabeth I) and this less-than-direct connection meant that James was eager to assert any legitimacy he could over his right to the English throne.

Coincidentally, Macbeth is the only of Shakespeare's plays set in Scotland, and it includes a nice little moment where he ties James I's ancestry to the rightful succession.

(2) Witchcraft was a hot topic at the end of the 16th and beginning of the 17th century. James I was particularly excited about witches—excited about hunting them down, that is—publishing his very own book about the subject, Daemonolgie, in 1597.

Coincidentally, Macbeth begins with the stage directions, "Enter three witches."

(3) In 1605, James was also the target of the Gunpowder Plot, where a group of rebel Catholics tried to blow up the King and Parliament. (This is where we get Guy Fawkes, that guy in V for Vendetta).

Coincidentally, Macbeth shows the murder of a king and alludes in Act II, scene iii, to the Catholic priest who encouraged Catholics to be deceptive and treasonous. These allusions would have struck a sensitive chord with the play's audience—a lot like referring to the attacks of September 11th.

Presumably, King James was happy enough with the play: Shakespeare's theater company The Kings Men, which was under the patronage of the king himself, survived the performance. But, even though the world is restored to normal at the end of the play, we have to wonder: was Shakespeare's critique of power intended to hit home? And did it?

http://www.shmoop.com/macbeth/