TL;DR: No, there is no medical reason to feed ice cream to surgery patients.
Although it's just a fictional movie, the premise is probably sound. He was recovering from surgery for a gunshot wound to the buttocks, and he kept asking for ice cream, which a young soldier freshly back from a tropical war zone would likely relish. Ice cream is high in protein, which a surgery patient needs, plus it has plenty of calories and fat, so it will clearly sustain him. So why would the nurses deny him if that's what he wants to eat? After all, he's a young, fit, otherwise healthy young man with no reason not to eat ice cream for a few days if he wants.
Are general surgery patients today routinely encouraged to eat ice cream? I can find no indication whatsoever in the medical literature (or popular press or anywhere else) that they are, and I can't imagine any reason why they would be.
But what about kids being fed ice cream after tonsillectomies?
Yes, that's common practice for the simple reason that soft foods are required following tonsillectomy, cold foods are soothing to a sore throat, and ice cream is both. It's even been referred to as a form of cryotherapy in one ongoing clinical trial, and Cleveland Clinic includes it in their list of post-op food options.
But being shot in the butt isn't throat surgery, and neither are the vast majority of other surgeries.
So, no. There's nothing medically important about ice cream following surgery.