Many people assume shoes are the cause of hammertoes. While they can be a cause, genetics are usually the driving force. Chances are if your parents or grandparents had hammertoes, you will too. Wearing shoes that are too tight or too narrow for your feet will cause you to develop hammertoes, along with a slew of other problems.
The best prevention for hammertoes is to be fitted for a pair of shoes. Being fitted by a pedorthist is much different than being fitted by a kid at a shoe store at the mall. A pedorthist is trained and educated to measure your feet, keeping in mind your specific foot type, and can prescribe the best shoe for your feet and activity.