Can a grandparent gain custody of an unborn child?
Nobody can have custody of an unborn child; the child is not born yet, and is therefore not a "child" for whom custody can be determined.
The second reason for this answer is obvious, based on biology.