I think the phrase is used to talk about when you will no longer be doing something -- but it can talk about other things than just leaving a job.
I would most likely use the phrase when someone is no longer doing a lively social activity -- like going out at night to dance clubs, going to many parties, being active in the dating scene, etc. Here's an example, "My best friends and I used to go out to the dance clubs every weekend. And after I got married, my husband and I would sometimes go to the city to eat at the really nice restaurants. But when our baby was born, I hung up my dancing shoes. Now on Saturday nights, we'll probably just watch a movie on TV after putting the baby to bed."
If I used the phrase to talk about retiring from a job, I would be speaking with a bit of humor. "Yep, I've been working at the company for 20 years. Now it's finally time for me to hang up my dancing shoes." Depending on your tone of voice, this could sound like playful humor or sarcasm (since working at a job is usually very different than the fun experience of dancing).