The vet probably found the hookworm eggs in the fecal sample of the snake. Fortunately, it's very simple to treat. First and foremost, I'd recommend doing a VERY thorough decontamination of all cages, water bowls, and any other items within the enclosure. You don't want to go through all the deworming, only to be reinfected later.
I have heard some people claim that the eggs can be transmitted from a rodent to a snake, but I do not believe this to be the case. Most parasites are host specific and cannot survive outside of those hosts for any length of time. Most likely your snake was infected by contamination from the fecal matter of another snake.