Prior to the Matrimonial Causes Act 1937 (so pre-1938), access to divorce in England and Wales was quite limited.
It is correct to say that a divorce could not be granted on the grounds of imprisonment or insanity - but it also could not be granted on the grounds of cruelty (absent adultery), desertion, or simply both parties being fed up with one another. However, it's not really meaningful to ask "the only reasons a divorce couldn't be granted" - there were fairly few reasons a divorce could be granted. Until 1938, it was basically adultery and only adultery, or a nullification.
(As an aside, one thing that could definitely prevent a divorce was collusion or mutual fault. Adultery had to be alleged by one party against the other; both being at fault was grounds for the court to refuse, as was evidence that the parties were working together to secure a divorce (which could be interpreted as simply remaining on good terms with each other). Read Holy Deadlock, an excellent polemic written against a foolish law in the guise of a novel. But I digress...)
So, where might this idea have come from?
This combative approach to divorce required an "A versus B" approach. Insanity of the defendant was held to prevent a criminal trial from taking place - both because they could not defend themselves and because they could not be punished. By analogy, it was considered by a court in an early case (Bawden v Bawden, which I've not got a date for but seems to have been in the late 1850s) that a divorce suit, which resembled a criminal trial, could not be brought against someone who was insane. Note that this is subtly different in theory from the law forbidding a divorce in such cases, though not much different in practice. I suspect the case that VSZ mentions above was worked out along the same "no insane defendant" logic.
This was the reason that the very high-profile divorce suit brought against Harriet Mordaunt in 1870 collapsed. However, the House of Lords considered it on appeal, and the eventual ruling in 1874 seems to have been that a divorce case was emphatically considered civil not criminal, and insanity would not prevent the suit being brought - in the end, her husband did indeed get a divorce on the uncontested grounds of adultery.
This encyclopedia entry (c. 1900) sums it up fairly clearly:
Supervening insanity is no bar to proceedings by (see Baker v. Baker,
1880, 5 P. D. 142) or against (see Mordaunt v. Moncrieffe, 1874, L. R. 2 H.
L. Sc. 374) a lunatic husband or wife for divorce or separation for previous
alleged matrimonial offences. Supervening insanity does not avoid a
marriage nor constitute per se a ground either for divorce or for judicial
separation (Hayward v. Hayward, 1858, 1 Sw. & Tr, 84 ; Hall v. Hall, 1864,
3 Sw. & Tr. at p. 349)
It left open one interesting question:
Whether insanity at the time an alleged matrimonial offence was committed is a bar to a suit for divorce or separation is an open question ; and in any event, in order that it may be so, the insanity must be of such a character as to have prevented the insane party from knowing the nature and consequences of his act at the time when he committed it (Hanbury v. Hanbury, 1892, 8 T. L. R. at p. 560).
So (at least in 1900) insanity might have been able to be presented as a defence to, eg, the act of adultery. This would still have allowed a petition for divorce to be brought and argued in court, however, which isn't the same thing as an absolute bar because of insanity.
The plot point in the original novel summarised:
...he had a wife that he married many years ago, who is now in an insane asylum. Under British law, Cartwright could not divorce his wife.
This seems to leave it possible that Christie described the law precisely - insanity was not sufficient grounds - but the TV version got the wrong end of the stick and concluded that insanity prevented a divorce. Alternatively, she herself may have been under a misapprehension. Would be quite interesting to see what the text says!