While it is hard prevent someone from crashing their car into yours, there are some things you can do to minimize you risk for a serious whiplash injury if and when a collision occurs.
The first preventive measure is making sure your seat is upright and the head rest touches the top of your head. If there is a lot of distance between your head and the rest, it will do little to help in the event of a collision. Also, if the headrest is too low, it can act as fulcrum, leveraging your neck into a worse position that increases your risk for injury.
Another thing you can do minimize your injury risk is to be in the best possible shape if a crash were to happen. Research has shown people with good aerobic fitness seem to be more resilient after whiplash incidents.
If you are aware you are about to be hit, it is probably best to remain in a neutral position with eyes facing forward. People with their head turned prior to impact seem to suffer worse ligament injuries.
If you can afford it, a larger car will lessen the momentum of your vehicle after a collision. There are now vehicles with whiplash-protection seats (e.g. Saab) that dampen the effects of rear end-accidents. Frontal collisions tend to be less severe to the neck if the speeds are equal because the chin can hit the chest preventing the forward motion of the neck. Rear-end and side-impact collisions do not have this benefit.
Unfortunately, there are many unavoidable risk factors. Women and children seem to be more vulnerable, possibly because of the increased head-to-neck size ratio. Also, if you've ever had a head or neck trauma before and/or if you have a degenerated disk in the neck, these factors elevate your risk for a more pronounced injury. Other factors that can slow your recovery include wearing a neck brace/collar, prolonged bed rest, or getting vertical traction treatments. Inhibiting movements can feel good initially but is not good in the long-term because it can result in decreased muscle function and strength in the cervical region.
Getting diagnosed as soon as possible can determine the best course of action for getting you to back to a speedy recovery. Just letting things go is rarely a good solution.