In order to preserve Wooden Ties against rot and decay, they need to be coated with Creseote Oil. The particular properties of this oil derived from Coal or Wood helps to waterproof and protect wood against many forms of insects and bacteria that would otherwise destroy it in short order.
Creosote Oil is obtained by cooking Coal or Wood in a Coke Oven. It is basically a free byproduct of the process. Though you will need multiple Ovens to produce it in quantity as it takes several minutes to produce and cannot be sped up any way other than this or by cooking coal in a very fast furnace like an iron, DM, or RM furnace.
Aside from crafting, Creosote Oil can also be found in dungeons.
Creosote Oil is used to craft Railbeds, which is used to make complex tracks (from Railcraft). Note that you will also require a Rolling Machine to make Rails in order to use the Railbeds effectively.
To make creosote oil, burn coal inside a Furnace. Creosote oil can also be produced by burning coal inside a Coke Oven. This produces Coal Coke as well as creosote oil as a byproduct. It can be made when Coal Ore is struck by a laser from a Mining Laser as well.