British Transport Police (BTP) said the incident happened on the Glenfinnan Viaduct in Lochaber on 21 March.
The driver also reported narrowly missing a man who had been standing on the railway with a camera tripod in the same incident.
The Glenfinnan Viaduct has featured in scenes for Harry Potter films.
The steam train was crossing the viaduct as it travelled between Fort William and Mallaig.
Matt O'Neill, of BTP in Inverness, said: "There may be some iconic scenery and wonderful vistas in this part of the world.
"While we don't want to spoil anyone's pleasure, people must be aware that trespassing on the railway line remains a criminal offence and the potential consequences do not bear thinking about."
BTP said it had also found out that local people were using the line between Edderton and Ardgay in Sutherland as a shortcut.
A steam train driver was forced to brake on a well-known Highland viaduct after spotting two older women standing dangerously close to the line.