Khunad is the town in the desert area. It's pretty easy to get locked up, as there lots of events that can land you in jail; if you run into a guard, don't comply with a search, or get caught sneaking around the guardhouse.
Once in jail, you have to actually start serving your time for the achievement to pop, so if you escape early using magic or the keys from the guardhouse you will not get the achievement.