The hair loss is something you can't really prevent. It occurs due to a process called telogen effluvium. Bariatric surgery shocks our systems, resulting in temporary trauma to the hair follicles.
Basically, the hair follicles go dormant for a while and the hair sheds.
The hair shedding due to telogen effluvium usually starts at 3 to 4 months post-op and stops before the 1-year mark. Some swear that biotin supplementation and Progaine shampoo works. However, the only proven treatment is time and healing.