On 21 December 1880, the famously prolific Anthony Trollope wrote to his son Harry: "I finished on Thursday the novel I was writing, and on Friday I began another. Nothing really frightens me but enforced idleness. As long as I can write books, even though they be not published, I think I can be happy." The novel he started that week was The Fixed Period and it was published in March 1882, the last year of Trollope's life. It received mixed, somewhat baffled reviews, and sold only 877 copies, making a loss for its publisher. It has not been any more popular since then. The story is set in the future, in 1980, on an imaginary antipodean island called Britannula, and therefore lacks the subtle observation of a recognisable social world for which Trollope's fiction is cherished. It has a first-person narrator, a technique he used before only in a few short stories, and in a style very like the urbane, sympathetic authorial persona of the earlier novels. The narrator of The Fixed Period is earnest and humourless. Most disconcerting of all to Trollope aficionados is the novel's subject: the effects of a law passed by the youthful Britannula Assembly making euthanasia compulsory for everybody between the age of 67 and 68.

The Fixed Period has been largely ignored by those who go to Trollope for a superior kind of comfort reading, and dismissed as an aberrant minor work by most critics and biographers. The article on him in the New Oxford Dictionary of National Biography describes it as "worthy of mention only as being so much out of Trollope's normal line". John Sutherland has described it as "the oddest item in all Trollope's fiction". In Trollope's oeuvre it is certainly unique, but also oddly relevant to some of our own current social, economic and ethical concerns. Due to advances in medicine and public health, Britain, like many other countries, has experienced a rapid rise in life expectancy in recent decades, which means that more and more old and retired people must be supported for longer by the working population, a situation that has been exacerbated by the global credit crisis, with a consequent rise in unemployment and fall in the value of pension funds. At the same time there is increasing public controversy and private uncertainty about the legitimacy of assisted dying in certain circumstances. It is fascinating to see an astute Victorian mind exploring these issues in the form of fiction.

In an introductory chapter, the narrator summarises the history of Britannula, an uninhabited island that was settled by a group of young emigrants from New Zealand (a country Trollope visited in 1875). The colony prospered and was granted independence by the British government. The narrator was the first speaker of its assembly, and at the time of writing is the country's president. He is a fervent advocate of the Fixed Period for rectifying "two mistakes … made by mankind; first in allowing the world to be burdened with the continued maintenance of those whose cares should have been made to cease … and the second, in requiring those who remain to live a useless and painful life." The aim of compulsory euthanasia is to convert death into a civic duty carried out with honour and dignity. For one year before their demise the old "would be prepared for their departure, for the benefit of their country, surrounded by all the comforts to which, at their time of life, they would be susceptible, in a college maintained at the public expense; and each, as he drew nearer to the happy day, would be treated with still increasing honour." It is a kind of utopian (or dystopian) version of the almshouses in The Warden (1855), Trollope's first successful novel. As to the expense of such a system, the narrator calculates that the savings that would accrue to the community by the elimination of its non-productive members would more than compensate. To his regret, however, this bold social experiment was thwarted before it could be put to the test, as he proceeds to relate.

This narrator is John Neverbend. Trollope liked to give some of his characters obtrusively symbolic names, wilfully violating the conventions of realism. (Henry James, who deplored the habit, said of Mr Quiverfull, the father of 14 children in Barchester Towers, "We can believe in the name and we can believe in the children. But we cannot manage the combination.") A name such as Neverbend is, however, appropriate in a fable of this kind. He is obsessed with his vision of benign euthanasia, and unable to empathise with the growing repugnance of the population as the time draws near to put it into practice. He is deeply offended when people refer to the method to be used ("certain veins should be opened while the departing one should, under the influence of morphine, be gently entranced within a warm bath") as "murder" or "execution". He is shocked when his friend Gabriel Crasweller, who voted for the law when it was framed, shows signs of reluctance to be "deposited" in the college, and even lies about his age. Neverbend regards voluntary euthanasia as a more effective way to banish the fear of death than religion can offer, and says to Crasweller: "How best can we prepare ourselves for the day which we know cannot be avoided? … Let us turn the inevitable into that which shall in itself be esteemed a glory to us …" To which Crasweller replies flatly: "But I am nine years older than you."

Although Neverbend is humourless, for the reader there is humour, and also pathos, in the clash of his high-flown rhetoric with the instinctive reactions of others, including his own family. Neverbend is a zealot, but not an insensitive one. As the opposition to the Fixed Period grows, he actually begins "to ask myself whether I was in all respects sane in entertaining the ideas which filled my mind", but steadies his resolution by remembering the example of great men such as Galileo and Columbus, whose radical ideas were mocked and rejected in their own time.

Halfway through the book there is a long episode about a cricket match played between Britannula and a touring team from England, which gives Trollope an opportunity to indulge his penchant for amusing names (Lord Marylebone and Sir Kennington Oval) and to fantasise about the future development of the game. In 1980 it is played by teams of 16 players, with mechanical aids such as a "steam bowler" and a "catapult", which require the batsman to wear wicker helmets and other protective clothing. The match is won by Britannula thanks to Neverbend's son's innings of 1,275 runs obtained with his special "spring-bat". Trollope's speculations about other technological developments in the world of 1980 are sparse and rather timid. Transport in Britannula is still mainly horse-drawn, though Neverbend does have a steam tricycle capable of 25mph. Trollope is more prescient about communications: the British naval officers have a little device that works very like a mobile phone, and there is another which allows voice messages to be sent across oceans and emerge as text. But the novelist is not really interested in the science-fiction possibilities of his story. The cricket match is introduced mainly to provide some humour and narrative excitement, and to foreshadow a second visitation from Britain – a gunboat sent to forestall the implementation of the Fixed Period law.

It arrives in Britannula's harbour just as Neverbend is conducting the sullenly compliant Crasweller to take up residence in the College. The officer in charge of the landing-party intervenes and forbids the president to proceed, invoking the threat of the gunboat's "250-ton swiveller". Neverbend submits, vainly protesting against this exercise of brute force, and is informed that the island is to be made a Crown colony again, with a new governor to ensure that the law of the Fixed Period, unacceptable to the mother country, is repealed, while he himself must go into exile in England. The narrative we have been reading is in fact written on his voyage there.

To readers prepared to suspend their usual expectations of a Trollope novel, The Fixed Period is an absorbing, thought-provoking and entertaining tale. But what prompted Trollope to write it? To most of its first reviewers it seemed like an extended joke in dubious taste, but when a friend referred to it as "a grim jest" Trollope gripped him by the arm and exclaimed: "It's all true – I mean every word of it." Because of its first-person narrative method the import of the novel remains ambiguous, but the remark shows that Trollope wished it to be taken seriously. His letters at that time show him gloomily conscious of declining health. He had driven himself hard for years, getting up at five in the morning to write for three hours every day before beginning his work as a civil servant, and he was also a keen huntsman and enjoyed social life. This regime took its toll, and by the late 1870s he was overweight, short of breath, and probably suffering from high blood pressure. Two days before finishing The Fixed Period he wrote to a friend: "I am now an old man, 66, and shall soon have come to the end of my tether." Victoria Glendinning quotes a letter to his brother Tom, written in 1881 or 82: "The time has come upon me of which I have often spoken to you, in which I shall know that it were better I were dead," and John Hall, editor of a collection of his letters, quotes words from another that seem particularly significant: "It will sometimes take a man more than 5 years to die." Trollope was not afraid of death, and said so emphatically to his brother: "There is nothing to fear in death – if you be wise. There is so much to fear in life, whether you be wise or foolish." What he feared particularly was evidently the living death of senility and/or physical helplessness.

It is a fear that haunts our own era. The advances in medicine that prolong our active lives also make it more likely that we will succumb to various forms of dementia, or survive a stroke for years in a helpless and barely conscious state. It is a fear to which writers are perhaps particularly sensitive, partly because they have highly developed imaginations, and partly because, like Trollope, they may become addicted to the exercise of their art and dread its withdrawal. It seems likely that he used the fable of The Fixed Period to explore and relieve his own anxiety by turning it into speculative fiction. Suppose a rational plan were devised to abolish the pains and problems of old age: what might it be like and how would it be received?

There is more than enough irony in the presentation of John Neverbend to prevent us from identifying his views with those of the implied author, but there is sympathy too, and Trollope allows him to argue his case logically and eloquently. The reprieved Crasweller argues effectively on the other side, affirming the human instinct to cling to life, and evoking the peculiar horror of awaiting a fixed date for one's death. Interestingly Neverbend boasts proudly to the British visitors that Britannula has abolished another institutionalised form of that suffering, "the stain of capital punishment", which makes him seem inconsistent, but more humane. At the end he feels betrayed but also secretly relieved at being removed from his invidious position, and concedes that "the Fixed Period, with all its advantages, was of such a nature that it must necessarily be postponed to an age prepared for it."

Trollope's odd novel proved, in one respect, uncannily prophetic of his own demise. Neverbend recalls that when the Fixed Period law was being framed there was a long debate about the age at which it should be applied. Eventually this was fixed at 67½, though some flexibility was later allowed. At the beginning of November 1882, the year in which The Fixed Period was published, Trollope suffered a severe stroke, which paralysed his right side and deprived him of speech, but the fate he had feared was mercifully brief. He died in a nursing home on 6 December, five months short of his 68th birthday.

• This article was amended on 17 December 2012, to include the phrase "a situation that has been exacerbated by the global credit crisis" in the fifth sentence of the second paragraph.