There are one or two things that can cause this.
One is (surprisingly) constipation and sorting that out can improve it.
Another reason is loss of balance in advanced dementia
It can also be due to the dementia itself (especially if there is also Parkinsons) - so called "Pisa syndrome".
Ive seen many residents in mums care home sitting in chairs with cushions on one side to help prop them up