The ponies accidently walked into the Everfree Forest. That's where Scootaloo, the fourth Cutie Mark Crusader, was flying. They didn't randomly run into Scootaloo, and they had a completely uneventful journey through the forest back to Ponyville.