Did Martin Luther accept or reject the existence of Purgatory? Martin Luther rejected many dogmas and doctrines of the Catholic Church. What was his belief concerning Purgatory? Did he accept it or reject it?
Luther's beliefs on purgatory evolved over time.  A quick search on the Internet will find people claiming he accepted purgatory, offering quotes to prove it, and others saying he rejected it, also offering quotes to prove it.  As such, a thorough investigation into his belief during different time periods is warranted.
95 Theses
Any investigation into what Luther believed about purgatory, must start at the beginning of the Reformation - Luther's composition of 95 Theses against corruption in the Catholic Church in 1517.   Among the 95 points, more than a dozen are about purgatory, including:

Hell, purgatory, and heaven seem to differ the same as despair, fear, and assurance of salvation. (#16)
Furthermore, it does not seem proved, either by reason or by Scripture, that souls in purgatory are outside the state of merit, that is, unable to grow in love. (#18)
As a matter of fact, the pope remits to souls in purgatory no penalty which, according to canon law, they should have paid in this life. (#22)
They [the papacy] preach only human doctrines who say that as soon as the money clinks into the money chest, the soul flies out of purgatory. (#27)
Who knows whether all souls in purgatory wish to be redeemed, since we have exceptions in St. Severinus and St. Paschal, as related in a legend. (#29)

Luther is disagreeing on some points about the nature of purgatory and certain is condemning claims that people can buy a quick pass through of purgatory for the dead, but he is not doubting its existence in any way.  It seems quite clear that he takes its existence for granted at that time.  Indeed, in his own Explanation of the Ninety-five Theses, he said he was unsure of the exact nature of purgatory but affirmed &quot;I am positive there is a purgatory.&quot;
Continued belief, but not as a matter of doctrine
In Defense and Explanation on All the Articles (1521), Luther wrote:

The existence of a purgatory I have never denied. I still hold that it exists, as I have written and admitted many times, though I have found no way of proving it incontrovertibly from Scripture or reason. I find in Scripture that Christ, Abraham, Jacob, Moses, Job, David, Hezekiah, and some others tasted hell in this life. This I think was purgatory... in short, I myself have come to the conclusion that there is a purgatory, but I cannot force anybody else to come to the same result.

Here, Luther is saying it is a matter of personal judgment.  He, himself, believes in purgatory, but won't hold it against anyone who comes to a different conclusion.  Likewise in Against Latomus (1521), he argues for purgatory while admitting that it cannot be proven by scripture.
In a 1522 sermon for the Festival of Epiphany, Luther said the spirits of the dead do not seek help from the living and said one is not a heretic for denying purgatory since &quot;The Scriptures know nothing of it.&quot;
Expressed doubts
In a letter to his friend Nicholas von Amsdorf later that year, Luther wrote that he was unsure what happened after death but felt that &quot;with few exceptions all sleep without possessing any capacity of feeling,&quot; waiting to the resurrected at a later date. He further said that the existence of purgatory was uncertain and that he wasn't convinced that all those not in heaven or hell were in purgatory.
The 1522 version of Luther's Personal Prayer Book contain the petition &quot;Have mercy upon all poor souls in purgatory,&quot; but the petition was removed in the 1524 edition.
Rejects the idea
In Confession Concerning Christ's Supper (1528), explicitly stated for the first time that purgatory was a false teaching.  However, he did say there was no real harm in praying for the dead since scripture didn't speak against it.  He said those who wished to do so could say &quot;Dear God, if this soul is in a condition possible for mercy, be thou gracious to it.&quot;
Two years later, in &quot;Exhortation to All Clergy Assembled at Augsburg&quot; Luther condemned the doctrine of purgatory and wrote that falsely claiming the ability to free souls from purgatory had brought great shame but &quot;lots of money&quot; for the church.  Also in 1530, he wrote Revocation of Purgatory, a tract denouncing the doctrine of purgatory.
From 1535-1545, Luther wrote and lectured extensively on Genesis.  These lectures were compiled and published shortly after his death in 1546.  In this work, he found several occasions to comment on the idea of purgatory.  For example, on chapter 4 he writes:

had we held Baptism and the holy Supper of our Lord in that esteem in which we ought to have held them, we should never have become monks. Nothing concerning purgatory, nothing concerning the sacrifice of the mass, nothing about those other like iniquities, would ever have been taught and handed down to us in the Church. But after the light of the Word had been put out by the wicked Popes, it was easy enough to thrust upon men all these abominations.

Thus calling the teaching of purgatory an &quot;iniquity&quot; taught by &quot;wicked Popes&quot;.
Summary
When Luther wrote his 95 Theses in 1517, he firmly believed in purgatory.  By 1521, he wrote that belief in purgatory was a matter of personal choice, but said that he personally continued to believe in purgatory.  Beginning in 1522, he began to express doubts in the doctrine and removed a prayer for souls in purgatory from his prayer book in 1524.  In 1528, Luther explicitly rejected the idea of purgatory for the first time, a position he apparently held until his death.

Note: All information is available in primary sources, which can be found in the collected works of Luther, Luther's Works published in 55 volumes by Concodia from 1958-1973