One of the most common questions is whether or not you will become dependent on a medication to remain happy and stable. That is very far from the truth.
The likeliness that you will need to take a medication for the rest of your life (or for many years) is not common.
Like most medical conditions, mental health disorders appear suddenly or gradually, they may relapse or recur, and they may be triggered and then resolve. Medications may be adjusted or discontinued as symptoms resolve and stability is achieved.
Since every mental health condition is different, it's impossible to say that your experience will be the same as everybody else. Ask your provider if you have questions about the duration of treatment.