My girlfriend is having eye surgery to reattach her retina. Can we still have sex?

Avoid it. All heavy exertion should be avoided after having retinal detachment repair. The risk of the repair not "taking" is significantly raised with excessive bearing down. Your girlfriend should ask her doctor how long she should refrain from heavy exertion such as sex.
Probably shouldn't. You probably shouldn't. The forces and pressure that can be exerted in the eye from having sex can cause problems with the retina during healing after retinal detachment surgery. Her doctor can tell her exactly how long she should refrain from having sex, but it is likely to be in the 2-4 weeks range.