Many people believe that the answer is simply technology, but there is more to it than that.
Early photographers had to ask people to stay calm for long periods of time, so it makes sense that many of them chose neutral expressions instead of smiling. Try to freeze your face in a smile, after a while it will become uncomfortable.
However, even when the technology improved and when the photo could be taken in less than a minute, people still refused to smile. Why? Probably because photography was very expensive at the time and was treated as a painting. It was like the historical preservation of a person, and it was preserved for years, usually long after the death of the person in the photograph. Indeed, the usual practice at that time was posthumous photography, in order to preserve the memory of a loved one.
Smiles have been appearing more and more in photos since the 20s and 30s. By then, technology had advanced to the point that cameras were not only owned by professionals. As more and more people came to their own camera, more and more unusual and surprising moments of life were recorded.
I never thought about it, looking at old photos. Really, no smiles.