All perfect praise be to Allah, The Lord of the worlds. I testify that there is none worthy of worship except Allah and that Muhammad is His slave and Messenger.
The scholars of Fiqh stated that the prayer is not valid for someone who prays standing while leaning against something in a way that if that thing was to be removed, he would fall down, unless he is incapable (of standing without support).
Al-Akhdhari, from the Maaliki School of Fiqh, said in his Muqaddimah (Introduction), “The leaning that invalidates the prayer of the person who is able to stand without leaning is when he leans against something in such a way that if that thing was to fall, he would also fall. If the person would not fall if the thing that he leans against were to fall, then this is disliked (but it does not invalidate the prayer).”
Besides, Sharh Al-Kharashi reads, “If a person is able to stand or sit without support and he deliberately leaned against something or did so out of ignorance, such that he would fall if the thing which he is leaning against were to fall, then his prayer is invalid and he must repeat it.”
If a person is unable to sit without support, then there is no harm on him to pray sitting with support (leaning against something), and he does not pray while lying down as long as he is able to sit with support.
Sharh Ad-Dardeer ‘ala Mukhtasar Khaleel reads, “There are five levels: standing without support, standing with support, sitting without support, sitting with support, and lying down…”
Ad-Dusooqi, from the Maaliki School of Fiqh, commented, saying, “In brief, it is obligatory to give precedence to standing without support over the levels that follow it. Likewise is sitting without support; it is obligatory to give it precedence over what follows it.”
As long as you suffer from intense pain when you sit without back support, then there is no harm on you, Allah willing, for praying while sitting on a chair with back support. Hardship in the Shariah brings ease, and Allah does not burden a soul beyond its capacity. However, if there is no hardship, then do not lean against the back of the chair.
As regards eating while leaning against something, it is disliked, as it is included in Ittikaa' while eating, which is disliked in the Shariah, as the Prophet said, “I do not eat while doing Ittikaa'.” [Al-Bukhaari]
The hadeeth narrated by 'Abdullah ibn 'Amr, reads, “The Prophet was never seen eating while doing Ittikaa'.” [Abu Daawood and Ibn Maajah]
The footnote of As-Sindi on Ibn Maajah reads, “Ittikaa' is to sit comfortably cross-legged, or to sit comfortably on a cushion, or to sit with the back resting against something, or to rest one of one's hands on the ground; all this is contrary to the required etiquette of eating. Some of this (kind of sitting) is done by arrogant people, and some of it is done by people who eat too much food.”
Allah knows best.