Can gallstones be hereditary?

Technically no. Gallstones are precipitated material- usually cholesterol, less commonly bilirubinate(black stones). But certain inherited conditions (eg sickle cell anemia) may oversaturate the bile to form stones. Some families have high rates- probable combination of inherited metabolic traits and dietary habits.