Okay, let's look at why this is so in the 19th century.
Painted portraits are the norm in the mid 1800s as I'm sure you've noticed, and you must also have observed that the people in the portraits are painted with serious expressions. Perhaps this is one reason you're being told not to smile: it's the norm.
Another theory is that no one smiled because of the long exposure times needed for the camera to take a photo - up to fifteen minutes in some cases. This means the subjects in the picture need to remain perfectly still for this amount of time.
Sounds like a long time to just sit like you're frozen?
Oh, I think you can cope with fifteen minutes of sitting totally still, can't you?
Another theory is that people didn't want to smile because they didn't want to reveal the bad state of their teeth due to wear, cavities or loss. But bad teeth are considered very normal in 1867, and not distracting from the general attractiveness of a person.
So, you can see that it is an old-fashioned way of thinking.
And now you know. Just don't say cheese! when you sit for this photograph.