Is it permissible to recite the Shema while lying down? For example, if a person went to bed and, while lying on his bed, he remembers that he must recite Shema, must he sit up, or perhaps even stand, for the recitation, or may he remain lying while reciting Shema?
The Gemara in Masechet Berachot addresses this question in two different contexts. From one discussion, it appears that one should not recite Shema while lying down, whereas in the second context is seems that one may lie on his side while reciting Shema. To reconcile these different rulings, Rabbenu Yona (Spain, 1210-1268) distinguishes between lying completely on one’s side, and lying on one’s back slightly tiled to the side. When the Gemara forbade reciting Shema while lying on one’s side, Rabbenu Yona explains, it refers to someone who is lying on his back and is turned to the side slightly. Reciting Shema in such a position is considered an expression of arrogance, and is therefore forbidden. It is permissible, however, to read the Shema while lying completely on one’s side, and this is the situation addressed by the Gemara when it allows reciting Shema in a lying position.
Rabbenu Yona also offers a second answer to resolve these seemingly conflicting sources, but most Rishonim (Medieval Halachic scholars) accept the first approach, as discussed above. This is, indeed, the ruling of the Shulhan Aruch (Orah Haim 63). Thus, it is permissible to recite Shema while lying on one’s side, provided that he is lying entire on his side, and not just leaning slightly to the side.
Hacham David Yosef, in his Oserot Yosef, adds that according to the Shulhan Aruch, it is acceptable to recite Shema in a lying position even "Le’chatehila" (optimally). A person who had gone to bed therefore does not have to sit up for Shema, and may remain lying for the recitation.
Summary: If a person had gone to bed and remembers that he must recite Shema, he may recite it while lying down on his side, provided that he lies completely on his side, and does not just turn slightly to the side.