A young man was injured after being hit by a train while crossing the railway tracks.