Is sleepwalking in offspring is inevitable? Apparently not. It is likely that heritable factors predispose an individual to develop sleepwalking (and/or night terrors), but the actual exhibition of the trait may be influenced by environmental factors.
As to "why" sleepwalking happens, general consensus is that there is a reason. Behaviors do not erupt from a vacuum. Some potential contributors include: