The men, aged 49 and 45, were walking two dogs on the CP Rail bridge when they saw a train approaching.
They ran to try to get to safety but one man injured his arm when he jumped clear of the tracks, and one of the dogs was struck and killed by the train.
RCMP and CP Rail police are investigating and say charges of trespassing could be laid.
It's the second incident involving pedestrians on the railway tracks in Cochrane within a week.
Last Thursday night, a young woman walking on the tracks was hit and killed by a train.
RCMP were investigating to see if she had been wearing headphones at the time.