The action takes place at the beginning of the XX century (in the years immediately preceding the outbreak of the First World War) in Switzerland, in a tuberculosis sanatorium located near Davos. The name of the novel evokes associations with Mount Gerzelberg (Sinful, or Magic Mountain), where, according to legend, the minnesinger Tannhäuser spent seven years in captivity with the goddess Venus.
The hero of the novel, a young German named Hans Kastorp, comes from Hamburg to the Berggof sanatorium to visit his cousin Joachim Zimsen undergoing treatment there. Hans Kastorp intends to spend no more than three weeks in the sanatorium, but by the end of the scheduled period he feels unwell, accompanied by a rise in temperature. As a result of a medical examination, he shows signs of tuberculosis, and at the insistence of the head physician Behrens, Hans Kastorp remains in the sanatorium for a longer period. From the very moment of arrival, Hans Kastorp discovers that time in the mountains does not flow at all like on the plain, and therefore it is almost impossible to determine how many days, weeks, months, years passed between these or other described events and how long the whole novel covers. At the very end of the novel, however, it is said that Hans Kastorp spent a total of seven years in the sanatorium, but even this figure can be considered as a certain artistic convention.
As a matter of fact, the plot and events that occur in the novel are absolutely not important for understanding its meaning. They are just an excuse to contrast the different life positions of the characters and give the author the opportunity to speak their lips on many issues of concern to him: life, death and love, illness and health, progress and conservatism, the fate of human civilization on the verge of the 20th century. Several dozens of characters pass in the novel — mainly patients, doctors, and nursing staff: someone is recovering and leaving the Berghof, someone is dying, but new ones are constantly coming in their place.
Among those with whom Hans Kastorp meets already in the first days of his stay in the sanatorium, a special place is held by Mr. Lodovico Settembrini - a descendant of the Carbonari, a freemason, a humanist, a staunch supporter of progress. At the same time, as a true Italian, he passionately hates Austria-Hungary. His unusual, sometimes paradoxical ideas, expressed in a bright, often caustic form, have a huge impact on the minds of a young man who begins to revere Mr. Sethembrini as his mentor.
An important role in the life history of Hans Kastorp was played by his love for the Russian patient of the sanatorium Madame Claudia Shosha - the love with which he, due to his rigorous upbringing in a Calvinist family, initially resists by all means. Many months pass before Hans Kastorp speaks with his beloved - this happens during the carnival on the eve of Lent and the departure of Claudius from the sanatorium.
During the time spent in the sanatorium, Hans Kastorp was seriously carried away by many philosophical and natural-science ideas. He attends lectures on psychoanalysis, he seriously studies medical literature, he is interested in issues of life and death, he studies modern music, using for his purposes the latest achievement of technology - recording, etc. In essence, he no longer thinks of his life on the plain, he forgets that he will find work there, practically breaks ties with his few relatives and begins to consider life in the sanatorium as the only possible form of existence.
With his cousin Joachim, the situation is exactly the opposite. He had long and hard prepared himself for a military career, and therefore considers every extra month spent in the mountains as an unfortunate obstacle to the realization of his life's dream. At some point, he can’t stand it and, not paying attention to the warnings of doctors, leaves the sanatorium, enters military service and receives an officer rank. However, very little time passes, and his illness worsens, so he is forced to return to the mountains, but this time the treatment does not help him, and he soon dies.
Shortly before this, a new character falls into the circle of acquaintances of Hans Kastorp - the Jesuit Nafta, the eternal and unchanging opponent of Mr. Settembrini. Nafta idealizes the medieval past of Europe, condemns the very concept of progress and the whole modern bourgeois civilization embodied in this concept. Hans Castorp finds himself in some confusion - listening to the long disputes between Settembrini and Nafta, he agrees with one or the other, then finds contradictions in both the one and the other, so that he no longer knows which side the truth is on. However, the influence of Settembrini on Hans Kastorp is so great, and the inborn distrust of the Jesuits is so high that he completely stands on the side of the first.
Meanwhile, Madame Shosha returned to the sanatorium for some time, but not alone, but accompanied by her new friend - the rich Dutchman Peperkorn. Almost all the inhabitants of the Berghof sanatorium come under the magnetic influence of this unconditionally strong, mysterious, albeit somewhat tongue-tied, personality, and Hans Kastorp feels some kindred relationship with him, because they are united by love for the same woman. And this life ends tragically. Once the terminally ill Peperkorn takes a walk to the waterfall, entertains his companions in every way, in the evening he and Hans Kastorp drink to the Brudershaft and switch to “you”, despite the age difference, and at night Peperkorn takes poison and dies, Soon Madame Shosha leaves the sanatorium - to this time, apparently, forever.
From a certain moment in the souls of the inhabitants of the sanatorium “Berghof” some anxiety begins to be felt. This coincides with the arrival of a new patient - the Danish Ellie Brand, who has some supernatural abilities, in particular, able to read thoughts at a distance and cause spirits. Patients are addicted to spiritualism, arrange sessions in which Hans Kastorp is involved, despite the caustic ridicule and warnings from his mentor Settembrini. It is after such sessions, and perhaps as a result of their former measured passage of time in the sanatorium that is violated. Patients quarrel, now and then conflicts arise over the most insignificant occasion.
During one of the disputes with Nafta, Settembrini claims that he corrupts youth with his ideas. A skirmish leads to mutual insults, and then to a duel. Settembrini refuses to shoot, and then Nafta fires a bullet in her head.
And then the thunder of a world war struck. Residents of the sanatorium begin to go home. Hans Kastorp also leaves for the plain, parted by Mr. Settembrini to fight where he is close by blood, although Mr. Settembrini himself seems to support a completely different side in this war.
In the final scene, Hans Kastorp is depicted running, crawling, falling, along with the same young men in soldier's overcoats who fell into the meat grinder of World War II. The author deliberately does not say anything about the final fate of his hero - the story about him is over, and the author was not interested in his life by itself, but only as a background for the story. However, as noted in the last paragraph, Hans Kastorp has little hope of survival.