Visit the Juvenile and Domestic Relations District Court for the county or city where you son and girlfriend reside after the child is born. The intake clerk will instruct you on how to file a petition for a determination of custody. Your son and his girlfriend are minors and will require a parent, guardian ad litem or adult representative in order to consent to anything. You will probably not be able to represent your son's interest as a conflict of interest exists. All three parties (with proper legal representation) can enter into a consent order granting you custody of the child provided the judge finds that custody arrangement to be in the best interests of the child.
You would be well advised to consult with a family law lawyer concerning your situation. Many family law lawyers offer free initial consultations.
Sign up to receive a 3-part series of useful information and advice about child custody law.