Answer: Cactus usually stand straight even when very crowded in their container, so I am not sure repotting would solve your problem. The time to repot if that is truly necessary and only if necessary would be in spring as it begins to grow again for the season. Use a sandy fast draining mix or cactus mix and move to only a slightly larger container. Do not set the cactus deeper than it is growing now.
If your cactus is tilting there may be some rot or other softening at the base of the plant or a problem with the roots.
Here are some good tips on cactus care you may find helpful. You may need to cut and paste the complete url into your browser to make it work correctly.
Q&A Library Searching Tips