How do I prevent varicose veins?

Hard to do. There are several things that can probably help to prevent varicose veins. Unfortunately, even if you do everything right (use prescription compression stockings, don't stand too long, don't gain weight, get exercise, put your feet up as much as you can, etc.) varicose veins can develop anyway. If you inherit the tendency to get varicose veins, you will still get them, but maybe less.
Several measures. Varicose veins are primarily due to genetic predisposition, pregnancy, injuries, prolonged standing and aging. So, prevention is difficult. Measures that can be helpful include compression stockings, regular aerobic activity, maintain a good weight, and avoidance of hot tubs/baths.
Stockings. Ted hose are available over-the-counter, and the common many colors. They look like leggings, but they are firmer compression.