Lysander and Hermia came to be in the woods on May Day eve because they made plans to escape out of Athens and run to Lysander's aunt's home in a neighboring city. Since Athenian law decrees that a father may kill a disobedient daughter, Hermia and Lysander decide to leave Athens. Lysander has a wealthy, widowed aunt outside of Athens who would be happy to take them in and they can marry there, as we see in Lysander's lines:
There, gentle Hermia, may I marry thee;
And to that place the sharp Athenian law
Cannot pursue us. (I.i.163-165)
They travel through the woods because it is more discreet; they have fewer chances of getting caught.
However, while in the woods their true love is tested due to the fact that Puck places a spell on Lysander. While waiting for Puck to return with the flower that has been enchanted with Cupid's arrow, Oberon observes Demetrius being cruel to Helena in the woods. Oberon tells Puck to use the flower to enchant a man he would recognize by his "Athenian garments" (II.i.269). Neither Puck nor Oberon have any idea that there are actually two Athenian couples in the woods that night. Puck instead finds Hermia and Lysander, and seeing Hermia lying so far away from Lysander, Puck interprets her actions as a sign of Lysander's hatred for her and his cruelty rather than as a preservation of her maidenhood. Hence, Puck enchants Lysander instead of Demetrius and, ironically, Helena is actually the first to wake Lysander instead of Hermia. Hence, Lysander and Hermia's true love is tested in the woods because now Lysander is under a spell, making him believe that he is in love with Helena and now hates Hermia. Oberon well describes how Puck's actions have now tested the lover's true love in his lines, "Thou hast mistaken quite, / And laid the love-juice on some true-love's sight" (III.ii.89-90).
Hence, we see that the lovers were in the forest that night to try and escape Athens so they can marry and that Puck tested the couple's true love through his use of enchantment.