There are some people who opt to live in imaginary worlds in order to escape the type of world that they are living in right now. There are some people who have been traumatized or hurt too much that they have decided that they only way they can cope is by not accepting the truth.
This type of condition can be cured with proper therapy and the support of other people who care for the person. Daydreaming is not a sign of mental disorder. People daydream from time to time. What makes escaping to an imaginary world a mental disorder when people begin to believe that the imaginary world is a reality.