Usually yes. But check with your lung doc.
Generally no. A recurrence at high altitude or while deep underwater scuba diving can be rapidly lethal. Individuals with recurrent spontaneous pneumothorax should not engage in high altitude travel, airplane travel, skydiving, scuba diving, etc... Until a surgical intervention is completed to treat and hopefully prevent recurrence. You should discuss with your physician your risk factors.
Maybe ok, if treated. A person with a tendency to get a pneumothorax (meaning one has already had a pneumothorax before, or one has medical conditions that could lead to a pneumothorax) takes a definite risk when flying, but the size of the risk is hard to determine. If permanent and/or surgical treatment is done, it may become safer to fly, especially if the person is a pilot and responsible for many other lives.