Various factors. Genetics plays a role (e.g. Dyt-1 and many similar childhood onset dystonias, etc). It may also come about from injury to certain parts of the brain (esp. The basal ganglia areas) from stroke, head injury, toxic exposure, certain diseases, and other causes, but for many (esp. Most adults who develop dystonia) there is no clear cause.
Complex issue. Dystonia is a description of motor dysfunction. It may be a form of static encephalopathy, an effect of injury to the brain, or a toxic reaction to a medication or treatment. There are progressive forms that appear in childhood and progress through adulthood. There are medications and procedures that help to modify the disorder. Most important is to determine the cause.