Question: May one lean on any given object during points of the prayer where one must stand, such as during the Amida prayer?
Answer: The Gemara in Masechet Zevachim (19b) states that according to the Sages, one who leans on something while standing is not considered standing at all. The Poskim explain that the Halacha follows the opinion of the Sages that if one is leaning on something, he is considered to be sitting, not standing. (Although the Poskim quote several different scenarios, we shall only write the bottom-line of the Halacha.)
The Tosafot (ibid.) therefore write that at a time when one is obligated to be standing, one should not lean on any object. The Rosh and other great Rishonim rule likewise. Maran Ha’Bet Yosef (Chapter 141 and end of Chapter 94) quotes their opinions.
Maran Ha’Shulchan Aruch (Chapter 94) rules as follows: “One should take care not to lean against a pillar (such as prayer stand, i.e. “Shtenders” or pillars of the building) or against one’s friend while praying (i.e. reciting the Amida prayer).”
Similarly, when one is required to sit, such as while reciting “Nefillat Apayim” (supplication prayer after Vidduy), Maran Ha’Chida (in his Sefer Kesher Gudal, Chapter 19) that one should lean against something and one may then recite the “Nefilat Apayim” in this way, for one leaning on something is considered sitting.
Nevertheless, regarding Birkat Hamazon, where Maran Ha’Shulchan Aruch (Chapter 183) writes that one must recite it while seated in order for one to be able to recite it with maximum concentration, it seems that one should not rely on this leniency and recite it while standing but leaning on something since one will still not be able to concentrate properly in this position. The great Rishon Le’Zion, Hagaon Harav Yitzchak Yosef Shlit”a rules accordingly in his Sefer Yalkut Yosef (Tefillah, page 442).
Summary: During the parts of the prayer service where one must be standing, i.e. while reciting the Amida prayer, one must not lean on any object, for when one leans on something, one is not considered standing.
If one is elderly or ill and cannot stand without leaning on something, one may do so, for this is certainly more preferable than actually sitting down.