People are resources, dictators (and oppressive regimes in general) don't want them to defect to other countries because they want them working for their regime. Some of them are going to be people that the regime has put their resources into, like scientists and doctors, but even laborers are valuable for actually gathering and assembling the resources the regime needs. Additionally, the regime especially does not want people with access to sensitive information to defect to their enemies. That isn't just spies and soldiers, there are plenty of "regular" government positions that require access to something the regime would not want falling into enemy hands, like economic data that could be used for propaganda. Obviously this is true of any country, and even in democracies with strong human rights records, people with access to classified information are usually required to submit to strict scrutiny of their international travel. Given that they aren't concerned with human rights, dictatorships can take the easier option of restricting travel to any citizens.
However, defection is really a piece of a bigger issue - oppressive regimes maintain their rule in part by controlling information. Here's an interesting article that talks about how dictatorships keep power. Jerrold Post, director of the political psychology program at George Washington University, is referenced:
Post said that in both Iraq and North Korea, dictators tightly controlled the flow of information. That control was upended in the past two years during the "Arab spring" revolts that swept away despots in Tunisia, Egypt, Libya and some of the Gulf states, revolts that were encouraged in large part by information spread by cell phones and social media.
North Korea is probably the most extreme example of information control (according to ReportsReporters without Borders, they are dead last in Press Freedom in the world), but this can be seen in other oppressive regimes - for example, China attempts to limit access to "wrong" information via its Great Firewall. This is thrown out the window if citizens go somewhere with free media and realize they are being lied to. Traveling can be the cause of their dissension, rather than a symptom.
Known dissidents may also be restricted from traveling so that they can not coordinate with foreign countries or anti-dictatorship organizations, and to prevent them from smuggling contraband or evidence of the regime's misinformation back into the country. Regimes can control the information originating in their country, but once someone is outside their borders the regime cannot control who they speak with.