Scooby and his friends got the van to help them with their Mystery solving carrers.
It is implied in many Scooby-Doo media, most recently Scooby-Doo! Frankencreepy that Fred is the owner of the van.
It is told that Daphne's father bought the van. However that wasn't officically confirmed till Scooby-Doo! The Mystery Begins was released. Daphne says it was supposed to be her brithday present when she turned 16. Back then It was the groundskeeper's broken down car. In a hint at it's name, Velma says "It's a Mystery this Machine stills runs."
It is also revealed in the What's New, Scooby-Doo? episode, It's the Mean, It's green, It's the Mystery Machine, (which the van is the main antagonist), that Daphne's father got the van from a retired called the Mystery Kids.
In Scooby-Doo! And The Goblin King, Krustdy turned the Mystery Machine into a Monster and renamed it "The Monstrous Machine" and sent it after Fred, Velma, and Daphne. (Shaggy and Scooby had not it back yet). It even destroyed a shack selling toys of Scooby's nephew Scrappy-Doo.
In Scooby-Doo! Legend of the Phantosaur, After Shaggy had had a horrible experience in a Haunted House, A Doctor told he needed to find a place to relax. However the Doctor also forbade Shaggy from setting foot in The Mystery Machine. Luckily Fred was able to disguise the Mystery Machine so Shaggy could set foot in it by calling "The Mustard Machine".