One reason the forest is an important setting in A Midsummer Night's Dream is that the forest creates a dark, wild, mysterious atmosphere in which the magical elements of Shakespeare's plot can be played out. However, more importantly, Elizabethans believed in the supernatural; they especially had a belief in fairies. Not only that, they believed that fairies lived in the woods; therefore, the forest would be a very natural setting for a play involving fairies as characters for an Elizabethan audience ("Act 4, Scene 1: Summary and Analysis," eNotes).
The Elizabethans held many beliefs about fairies that are very unusual from our beliefs about fairies today. For one thing, Elizabethans did not picture little creatures with wings. Instead, they believed that fairies were the size of small humans and looked just like humans. Fairies were also associated with nature, hence the forest setting. However, Shakespeare's fairies diverge from popular Elizabethan mythology in that he does describe them as having the ability to fly, even at very fast speeds, as we see from Puck's line, "I'll put a girdle round the about the earth in forty minutes," meaning that he will circle around the earth in forty minutes (II.i.178-179).
Elizabethans also believed that fairies had magical or supernatural powers; hence, the forest is a perfect dark, mysterious setting where magic can be performed. However, again, Elizabethan folklore differs from Shakespeare's presentation of fairy magic. Elizabethan's believed that fairies were wicked and soulless and did everything within their magical powers solely for their own benefit. Shakespeare presents the fairies as mischievous beings who like to play their share of pranks, but in the end ultimately strive to help human beings. We especially see this characterization of fairies in Puck's closing lines for the play. He asks the audience not to hate them for the tricks they had played and to forgive them as they have made everything right in the end, as we see in his lines:
We will make amends ere long
Give me your hands, if we be friends,
And Robin shall restore amends. (V.i.429-433)
Hence, we see that the forest is the perfect setting for Shakespeare's fairy story as it fits Elizabethan folklore; however, he chose to diverge from commonly held folklore and create a more lovable fairy character.
The forest is an important setting of the play because that's where Hermia and Lysander run off too, and the entire plot happens in the play. The fairies, such as Puck and Oberon, are located there too which are the two characters that triggered the conflict to arise. If the setting would not have been in the forest, there would be no need of the use of fairies in this place. It would make no other sense for any other setting for this play to work.