This is an excellent question. It calls for speculation. For plot purposes, the lawyer had to be in poor physical condition because he was considerably younger than the banker. The banker plans to kill him in order to get out of paying him two million roubles. But he can only contemplate doing that if the lawyer is in no condition to put up a fight.
"Poor creature!" thought the banker, "he is asleep and most likely dreaming of the millions. And I have only to take this half-dead man, throw him on the bed, stifle him a little with the pillow, and the most conscientious expert would find no sign of a violent death."
That explains the plot purposes for making the lawyer so emaciated. But is it plausible that a young man who spent fifteen years in solitary confinement would look so much older than his forty years? There are several possible reasons for his debilitation. He has spent fifteen years without getting any fresh air or exercise. In recent years he may very likely have stopped eating properly. He may have even deliberately starved himself like certain holy men he has read about in his books. Lack of nourishment would have an important effect on his physical condition. Lack of exercise, doing nothing but sitting in a chair reading, would cause all his muscles to deteriorate. Lack of exercise could also have a debilitating effect on his heart and other internal organs.
The lawyer's feeble condition at the story's end is necessary for plot purposes. The elderly banker must be able to suffocate a man much younger than himself and do it quickly, painlessly, and noiselessly. But the lawyer's condition does not seem unrealistic. Men will change considerably with age between twenty-five and forty, and the abnormal living conditions of the lawyer would conceivably expedite the natural degeneration that occurs between youth and middle-age.