Statistically it's not as dangerous as many other cities, and in recent years crime rates have declined, but you do need to be careful. Staying safe in New York is a matter of common sense.
Many people jam into subway trains during rush hours.
Getting caught in the press of bodies can be frightening if you're not used to it. However, you are safest when the subway is crowded. The most dangerous time to ride is late at night when trains are deserted. They are generally in sight of the token booth where someone is on duty. Do not walk down empty stairwells.