Even though we distance ourselves from causing the ill person distress, and for this reason we wrote in siman 335, section 10, that one does not mention the matter of confession to him, nevertheless, our sages, of blessed memory, commanded us (Shabbat 32a) that if they see that he is leaning toward death – they tell him to say the confession. And even though perhaps he will be distressed by this, nevertheless, it is impossible for him to die without confession, as this is a great principle and a merit for the soul to bring it to the life of the World to Come. And the proof: for all those executed by the death of the beit din confess before their death, even though we are not as concerned for their benefit, and all the more so for an ordinary Israelite. And behold, Achan, who trespassed against the ban, and through him many of Israel fell, and despite all this, Joshua said to him, "give thanks," meaning: confess yourself, and through this you come to the life of the World to Come.
אף על פי שאנו מרחיקין עצמנו מלצער את החולה, ומטעם זה כתבנו בסימן של"ה סעיף י שאין מזכירין לו עניין וידוי, מכל מקום צוו לנו חכמינו ז"ל (שבת לב א) דאם רואים שנוטה למות – אומרים לו שיאמר וידוי. ואף שאולי יצטער על ידי זה, מכל מקום אי אפשר לו למות בלא וידוי, דזהו עיקר גדול וזכות לנפש להביאו לחיי עולם הבא. וראיה: שהרי כל המומתין במיתת בית דין מתוודין קודם מיתתן, אף שאין אנו חוששין כל כך לתקנתם, וכל שכן לסתם ישראל. והרי עכן שמעל בחרם, ועל ידו נפלו הרבה מישראל, ועם כל זה אמר לו יהושע "תן תודה", כלומר: התוודה עצמך, ובזה אתה בא לחיי העולם הבא.