Start with slacks that have expandable waist bands and give, leggings are high on my list or yoga pants or you can even find jeans with some stretch.
As always when travelling layer, this is necessary as it is really difficult to judge what the temperature will be like on a train. Sometimes even in the summer it can be cold when you sit for hours with the A/C turned on. If you are on an overnight this is especially true.
It depends on your train and destination so dress as if it will be hot but take a cardigan sweater in case you need it. In colder weather of course take cloths for your destination also but be prepared to take layers off if the heat is turned up.
A good scarf can be used to cover you for a day trip but for overnight in coach have a blanket.
A nice tote bag is necessary to carry all the things you may need along the way.
Good flat shoes that are not going to slip off when you get on and off the train or when you are walking around. Sometimes getting on and off the train carrying luggage can be tricky. Shoes with suitable support will help keep you from falling. Also your shoes should have rubber soles and don't wear flip flops or high heels.
If you are on an overnight train especially if you are sharing a compartment you will want to wear something comfortable to bed but not revealing...not pj's. Socks are a good idea.
Your top should also be loose and comfortable and in a nice breathable material.
Most people dress fairly casual but some people wear sundresses in summer and men wear slacks and dress or polo shirts if using the dining car. Luxury trains are an exception and you need to check with them as to the dress code
Make sure nothing is too bulky as you may have to put it in your bag to go to the dinning car or washroom especially if you are travelling alone. If you leave anything behind at your seat you may find it gone when you get back