It’s what I’d always expected of my teachers, having to stand up the front of the classroom and look like they were in control.
These days, not so much, but back in my day, teachers, and particularly the men, were to be feared, and stern expressions were the least of the features of an effective teacher.
So, in this context, it means a hardness or severity of manner.
Whilst in a sense that was frightening to us kids, another form of the word also can be used to express a forbidding or gloomy appearance.
Grandfathers also have that stern look, but it’s more forbidding, more authoritarian, more severe, more austere, well, you get the picture. A six-year-old would be trembling in his or her boots.
There again, in facing up to either possibility above, you could stand firm with a stern resolve not to buckle under the pressure.
Of course, not a good idea if you’re facing a tank (with a stern-looking tank master)
If you’re standing at the end of the boat, not the front, but the rear, you would be standing at the stern of the boat, or ship.
Oddly, when issuing instructions to go in reverse, not something you would say if you were on the bridge, you would instead say, or possibly yell, full speed astern, because you’re about to hit an iceberg.
Or some idiot in a jet ski who likes to think he or she can beat the bullet (or 65,000 tonnes of a ship that has very little mobility).