(Answer specific to Sagliains station, the question title asks a broader question.)
Unlikely, but not impossible
Schedules at Sagliains are such that connecting trains are facing each other, leaving little time to get lost (or to hide from the eyes of train staff). For example on fridays and saturdays, the last trains of the day arrive at 23:52 and 23:56, and depart at 23:58 and 00:00. This is Switzerland, and the connection works quite reliably (unless some rare event happens, see below). Train staff (of the later departure) will normally care not to leave while there are still passengers on the platform (but will ask them to hurry).
Yet it will certainly be possible to get stuck on the Sagliains platform accidentally: on a foggy day, or in a heavy snowstorm... Morning train is scheduled for 05:58 am, you may or may not want to wait.
Interdiction to cross tracks might not be your biggest problem
Not talking about official regulations here (ask railway operator), there will be a phone number – assume broken batteries.
Sagliains station is somewhat isolated, but not far away from civilization. The nearest hotels in Lavin are just 700 meters away, i.e. well within walking distance, so one might try. While passengers are not allowed to cross the tracks (and Rhaetische Bahn will deny any liability), there will be nobody around to enforce that restriction. Get off the platform somehow (unless you have a disability that prevents you from doing so, or heavy luggage), cross track and a stretch of meadow, and follow nearby road. That's it. (But there is no light once you have left the station – remember your battery is broken).
On a dark late evening, well after the last departure (and even more so in bad-visibility weather) it might even be safer to walk all the 800 meters to adjacent Lavin station on the tracks – just to make sure not to get lost, and not to step into something dangerous. (Keep ears open, speed limit on that stretch of railway is 70 km/h.) Personally at night in Lower Engadin I might feel more afraid of sliding/falling off a cliff I did not notice, or having an encounter with a bear, than with either the police or an unheard train –
An unusual accident had happened on a late evening in April 2012 on the same train line some 15 km east of Sagliains: A bear collided with a Scuol-Tarasp–Klosters train near the station Ftan Baraigla; the animal was reported not to have suffered serious injuries w:de. Supposedly the train had then missed the connection at Sagliains on that evening.
And the bear had probably learnt to respect "Do not cross tracks" signs, but was shot a year later for continued misbehaviour...