Swollen ankles tell you that there's a build up of fluid there- it's not being returned back into the general circulation as effectively as it is normally.
Swelling at the ankles can happen because of many things: A problem with the circulation- because the heart isn't pumping as well as it used to, or because of the way that the kidneys filter the blood. It can happen because certain types of medicines have been changed. It could be related to obesity, we don't know. There are other reasons too, but listing them will not change what you should do.
In order to find out the cause of the swelling, speak with your GP. You've said they have prescribed strong painkillers- for pain. But did you mention the swollen ankles? To work out the cause, the GP will have to ask specific questions and the answers you give to these questions will help with diagnosing what the underlying problem is. But unless the GP knows what your specific problem is, you may be at cross purposes. It might sound like I'm teaching you to suck eggs here, but we know nothing of your husband's health before this diagnosis. For example, if he had episodes of pain beforehand, the GP may have given your latest painkillers because they assumed it was for an exacerbation of an old pain. Similarly, he may have had a tendency to swollen ankles which was hidden because he was pottering about and is more evident if he's sitting for longer now.
Think about what you could be doing to encourage your husband to manage the swelling more effectively until you clarify things with the GP. Has your husband taken to his chair more since the diagnosis because he's fearful? If you sit more, your circulation will suffer. Someone pottering about will be working the muscles in the legs, which act as pumps to help the resolution of any mild swelling. We all know people who complain that their legs swell if they're on their feet all day - what do they do? - they put them up for an hour or two. But if you put your feet up for hours and stay immobile, you can have swelling as well. So the little and often approach to activity often helps.
He's now taking strong painkillers which probably zonk him out and reduce his enthusiasm for movement, so time any exercise activity to when he's at optimum pain AND energy level to get things moving. Don't lie with the legs straight out in front elevated - get a small bend in the knee with a cushion- It helps the circulation behind the knees. Get him to circle the ankles for 30 seconds every hour - especially the pulling the foot up bit. Get him to squeeze his bum cheeks together. All this sort of stuff is just maintenance whilst you sort the underlying stuff out. Your hips, knees and ankles are joints that are designed to move. if you stay still because you're fearful and not even doing any of the stuff I've listed above, you'll end up like a gate with rusty hinges that doesn't move easily- and then take every creak to mean something sinister.