A lot of older cameras (and early phones too) would have a small mirror next to the lens, specifically for taking photos like that. The word selfie is kind of recent. The concept of taking a photo of yourself is probably as old as the invention of the camera.
I remember watching a podcast at the time where they were making fun of the word selfie for being an absurd unnecessary word. I remember vehemently agreeing.