A couple of German states actually did that for a while. It just never stuck - the technological and logistical limitations of the time make it a relatively ineffective gesture. You can't stop emigration with the means of the pre-WWI state. You can stop legal emigration, but that's not really something you want to do. And most governments figured out quickly that emigration was a net plus for everyone (except the Native Americans). So the reason can't be economic and it can't be effective...
I think Russia is your best bet for a major power. For an idea: Decembrist reformists are somehow more successful (maybe not having a coup and influencing policy in other ways?) As a result, Russia introduces mandatory public education and abolishes serfdom. So far, so good. A few decades later, it is pointed out to the Czar that schools cost a fortune (anything on the scale of Russia does) and every Russian who leaves the country after having gone to school is a net loss to the fisc. The government opines that anyone wanting to colonise a frontier can bloody well do that in Siberia and Central Asia, and a ban on emigration is enacted.
In the long run, the system won't hold. Russia has lousy feedback mechanisms, so responses are liablew to arise locally and on a case-by-case basis. Exceptions will certainly be made both for the wealthy and the connected. The bureaucracy involved in processing this is going to inspire a good deal of satire. We will also see temporary travel permits for anyone intending to return, including the hundreds of thousands of Polish migrant workers keeping Prussia's great estates going and the Czar's Muslim subjects making Hajj. I wouldn't want to guess at the cost, most likely it will be offset by fees and bribes. Suckage all around, basically.