I think there are some situations in which I would definitely feel the same way. The surgery is a good example. While he's with you and supporting you, you need to know and trust that he's giving you his attention and not talking about having sex with others.
It seems to me, surgery is a one-time thing, and there would be a bunch of appointments, but during the appointments and the surgery, he should keep it non-sexual. Warn others that he's your husband first and foremost at these times.
This being said, I'm not sure it would apply to the whole day. Was the appointment the whole day?
I would try to understand if it's his way to cope (maybe he's worried about you and want to take his mind off of it for instance) but let him know it makes you feel lonely and like he's not there for you.
When Seamus had to go to the hospital, I stopped things with my friends with benefits, which he understood completely. It wasn't even out of respect or anything like that, I just wouldn't have been able to without feeling guilty. I still talked to him, but not about anything sexual. I mostly talked about Seamus, really.
When he left the hospital, he asked me about it, and I told him nothing happened while he was there, and he said he was relieved as he would have felt betrayed. And in that case it was for a week or two, so even after I was less worried because things were better, waiting really wasn't an issue.
I think I would have been very upset with my friend if, knowing my pretty-much-husband was in the hospital and needing surgery, he still had tried to be sexual. I would have taken it as a lack of respect for him and for me. I'm curious if your husband's friends know the situation and are sexting anyways.
Then again, as I said, it could be a distraction for him, helping him cope. Or it could be that he just doesn't understand what your problem with it is.
Tell him you need him to take a break and know you're there for him. His friend will still be around after next week, and she doesn't need that extra level of support you do right now. It's not like you're asking him not to see her for years. It seems you're not even asking her not to see her, provided they don't have sex while you're stressing out about your surgery and would rather have him (and maybe her, depending on how you get along) by your side, helping reassure you.