Iran is a big country, with hundreds of kilometers between major cities. Trains are a good way to bridge those long distances.
On long distances, trains are faster, more comfortable, safer and more environmental friendly than buses. In addition, overnight trains allow you to save on accommodation and extend your daytime sightseeing hours. The major downside is that you need to plan your journey in advance; most trains are sold out in advance.
Train travel is a safe, comfortable and inexpensive way to get around. In fact, it can be more enjoyable to use Iranian trains in some routes than internal flights! Food and drink vendors will also make their way through the compartments, mostly in sleeper class.