Is masturbating a problem during pregnancy?

No. However, avoid inserting any objects into the vagina that could traumatized the area.
Can't see why. Of course there can be dangerous actions a person could take that could endanger you, your baby and even others, but putting those aside (right?) - common female masturbation will not harm a fetus. Orgasm is recommended even toward the very end of pregnancy for many women. Be happy, enjoy yourself and relax.