It could be a cognitive disorder. The pooping could be medical too--constipation perhaps? My Odo definitely has some cognitive issues and at least some vision loss as well. It's not easy to know how many of his problems are due to cognitive issues versus vision. Staring into space can be due to either one. With Odo, he doesn't have any problems using the litterbox, but sometimes he will sit in it for a while like he has forgotten where he is. When that happens, he's not squatting (so he's not showing signs of blockage or constipation) but he just sits there. Sometimes he meows too, like he's lost and doesn't remember where he is supposed to go next. I'll call him, and he'll regain a sense of direction and come out. It's hard to see our babies so confused, but in Odo's case, he still seems very happy most of the time (or at least happy for him--he's always been a bit of a stress case).
I'd suggest having Popsie checked for arthritis the next time you go to the vet. Pooping on the bed could potentially be him seeking a softer surface. There are supplements and pain medicines that can relieve some of the arthritis symptoms (Odo takes Tramadol) and ease movement.