I would think the best case solution would be a bigger pot which the cactus can lean against. That may mean the pot is overly deep for the roots, but you can underfill it and get good results. To some extent you can point the stem of the plant more upright, but any sideways lean will probably be amplified over time as the plant settles in after repotting, unless there is support. Another option would be to lean the top against/on top of another plant's pot in a mostly permanent way. I can imagine the pot to the right rear would be suitable for this.