Why does Shakespeare use the device of magic in A Midsummer Night's Dream?
To answer this question we need to think of the ways in which magic is used as a dramatic device to support the main theme of the play. Magic is principally used in the flower that Oberon uses to make various characters fall in and out of love with each other. It is this that he uses to make Titania fall in love with Bottom (who has been helpfully given the head of an ass by Puck) and also it is this same flower that is used to sow such confusion amongst the Athenian lovers. However, if we look at Helena's famous speech in Act I scene 2, we can see how these magical acts support the theme of the way that love as a force overrules our reason and senses and makes us fools:
Things base and vile, holding no quantity,
Love can transpose to form and dignity.
Love looks not with the eyes, but with the mind,
And therefore is winged Cupid painted blind.
Of course, the perfect example of this is in the way that Titania falls in love with Bottom. He is certainly "base and vile" with his new head, but the magic of love makes him appear with "dignity" in her eyes. In the same way, Shakespeare uses magic to poke gentle fun at the protestations of the Athenian lovers in Act I before they enter the woods: magic is a force that reveals us to be the fickle, changeable individuals that love shows us to be.