This is a difficult question to answer without further information. Are they softwood or hardwood reproduction railway sleepers or genuine reclaimed sleepers? How bad is the wood rot?
If the wood has started to rot there's probably little that can be done to stop this. You may be able to slow down the inevitable and improve the appearance of the wood by removing as much of the rotted wood as possible, then applying a wood hardener like
Ronseal Wet Rot Wood Hardener
to the affected areas. Repair any holes, gaps or uneven surfaces with a suitable exterior wood filler and treat all sound, good wood with an exterior wood preservative. To preserve the sleepers further, we would recommend treating them with an exterior wood oil or decking oil, ideally twice a year in Spring and Autumn. This will help to repel water and prevent water ingress, the main cause of wood rot.
Unfortunately, if the sleepers are being used to retain soil and the soil is in contact with the wood, there's probably not much that can be done to protect the soil facing surface.