Dante wrote Inferno while in political exile from Florence, and he used it as a vehicle to express his political beliefs and take comfort in imagining bad ends for his enemies. However, the poem's main purpose is, to quote Milton, to "justify the ways of God to Men."
The persona "Dante" in the poem is not so much lost politically—as the poem opens he imagines himself as not yet having been sent into exile—as he is spiritually lost. As he explains in the opening canto, he finds himself midway through life wandering in a woods, unable to locate the strait and narrow path back to God. He writes the story of his fantastical journey through the spirit world from hell to purgatory to finally seeing the face of God in heaven chiefly to offer spiritual instruction and encouragement to the faithful who might be danger of falling away as he did.
To this extent, while Dante is the bruised political figure, the work transcends that. The poem's Dante is everyman, reflecting the part in almost all of us that both longs for and feels in need of spiritual guidance.
The emphasis in the Inferno is on this spiritual instruction. It is not only important for the persona Dante to see in graphic terms that there are real and dire consequences to our actions in life, but to understand that God's justice is perfect. In hell, Dante is weaned away from relying on his own emotions and understanding when, for example, he comes to realize he should not feel undue pity for those who suffer there, such as Francesca, who is forever buffeted by winds because of her lust. At first, he feels great sorrow for her but later comes to understand that our afterlife is in our own hands.
The poem, at core, teaches that aligning our vision with God's vision is the route to the good life both on earth and for all eternity.
Dante wrote the Inferno partly as an allegory for the spiritual journey he was embarking on after his exile from Florence and partly as an allegory for Florentine political life in the late thirteenth and early fourteenth century.
At the time, Florence had split into two political factions: the black Guelphs who supported the papacy and the all-encompassing power of the pope, and the white Guelphs, of which Dante was one of the leaders, who wanted the Pope to have less influence. The pope at the time, Pope Boniface VIII, was not only known for interfering in the conflicts of other countries, but also for inflicting acts of sudden violence.
After much toing and froing, the black Guelphs finally took power and Dante was exiled from the city of Florence.
Therefore many of the people he has punished in in the Inferno are his political rivals. For example, in the eighth circle of hell, he punishes members of the Catholic church for Simony (profiting from their high position in the Catholic Church) by putting them upside in round holes and burning their feet. It is here that Dante suggests Pope Boniface VIII will come when he dies.
However, Dante didn't just want to call out and mock his opponents. He also wanted to create a work of philosophy and political ideals that spoke to everyone. Therefore he wrote the book not in the traditional Latin, but in his regional dialect of Tuscany. He knew that the more people his work reached, the more people that could potentially rise up against the papacy.
Dante wrote The Divine Comedy during a period of personal and political upheaval, and the work reflects many of the issues in Florentine political life, literary history, and Dante's personal life.
On a political level, Italy at this period was not unified—unification was not completed until 1871—but instead consisted of various small states often involved in rivalries against each other or affiliations with different larger European states. Florence, Dante's native city, was caught up in a contest between two factions know as the the Guelphs and Ghibellines, with the Guelphs tending to support the papacy and the Ghibellines supporting the Holy Roman Emperor.
Dante supported the Guelphs. They triumphed in Florence but then fractured into two factions, the black Guelphs, who were strong supporters of Pope Boniface VIII, and the white Guelphs, who were opposed to some of his policies. Dante and the white Guelphs were on the losing side, which resulted in Dante's exile from Florence. Many of the people who populate the Inferno are Dante's political opponents. Some appear under their own names and some appear under pseudonyms. Thus, the poem is partly intended as revenge for Dante's exile, and it also serves as a critique of clerical and political corruption. Thus, personal and political motives mingle in the poem.
Next, in De vulgari eloquentia, Dante argues for the possibility of creating great epic literature in the vernacular. The Divine Comedy is written in Italian and is an example of the sort of national vernacular epic Dante advocated.
Like the rest of The Divine Comedy, Dante's Inferno is a vast work encompassing many ideas, questions, and themes. However, Dante had a few major reasons for writing this first part of his epic poem. First of all, Dante wanted to write an account of the search for spiritual atonement and salvation, and this desire drew heavily from Dante's own experiences. Dante was living in exile while writing Inferno and so, much like his poetic counterpart, he felt like he had lost his way and needed direction. In that case, Inferno is in many ways Dante's attempt to work through his own feelings of being lost and unsure of himself, especially in spiritual terms. Secondly, Inferno is a critique of the corruption of both the Catholic Church and Italian government, especially the government of his native Florence. Many of the tortured souls that Dante encounters in Hell were actually real people, and many of them were high ranking Italian politicians or Catholic Church officials. Thus, Dante uses the poem as a method of critiquing the most powerful Italians of his day, and so the poem is not only an account of a spiritual journey, but also an attempt to motivate real social change and reform by exposing the wrongdoings of those in power.