A concept from the Spanish mystic and poet St. John of the Cross who writes about it in his poem Dark Night (Noche Oscura) in 16th century.
In modern times, the phrase relates to a stage in personal development when a person experiences a crisis in private of professional life and feels confused, sad, lonely or anxious. This stage can last quite a long time, maybe even a year or two. During this dark time of your soul, you see no way out, it’s dark. Slowly you might start to realize that you don’t like to hang around the people you used to socialize with, or that you don’t like the stuff/things you used to like, that you are not the same person any more. Something in you changed as a result of this crisis. You feel that you are transforming, becoming a different person, but you are not there yet, you are on a journey of becoming, so it’s dark, you feel confused, lonely, misunderstood or anxious.