Anesthesia is very hard on an elderly person and there is often increased confusion after an elderly person has surgery. Sometimes it clears up and sometimes it doesn't.
Being in a hospital can also be very disorienting for an elderly person. Hospitals are 24/7 and sometimes this can cause increased confusion in an elderly person.
Once you get her home get her back on a schedule and see if that doesn't clear up some of her confusion.
Many people get confused in hospital, called something like hospital psychosis. Usually diminishes once they get back and get home. If going to rehab you will still see some confusion but as she gets better do does the confusion. Although it may not fully go away. Perhaps gently reminding her what happened and where she is then change the subject. When my mom was in rehab and was confused, I would put her in a wheelchair and take her outside or for a ride around the facility. Paint nails, play cards, do a crossword puzzle together, anything to keep her busy and not dwell on her confusion.
Being in a hospital can also be very disorienting for an elderly person. Hospitals are 24/7 and sometimes this can cause increased confusion in an elderly person.
Once you get her home get her back on a schedule and see if that doesn't clear up some of her confusion.