IANAL - but…
Basically a contract is a payment for consideration. I do X or give you X, you pay me Y. Some things are not contractable(?)- obviously, you cannot sell a person. Anything surrounding marriage has it’s own set of laws, generally.
I suspect the judge would toss the case on numberous grounds; but specifically - if the GF becomes pregnant - whose fault is it? If the BF made her pregnant, then he obviously was willing to accept the consequences when he did the deed. Every birth control includes a risk of failure and determining what caused the “accident” a few months later is pretty tricky.
If the guy expected to be able to continue reproductive actions and not suffer the consequences, it would seem to much like a contract for prostitution. Even worse if the contract was “He will pay her if she does not have a child…”
In every “contract” there is an inherent duty to mitigate. You must take reasonable steps to prevent the damage being any worse than it needs to be. If you sit in your nice warm house and watch a freezer full of meat spoil because the freezer died; and there’s an icy garage just out the door - the judge is not likely to make the appliance company pay you for the meat you could easily have saved. (Whereas, if you came home from a weekend out to find the stinking mess- different story).
So what would the BF’s duty to mitigate be in this case? Don’t have sex? He is at least 50% to blame for the contract failure, more than 50% if he did not use a condom when he could have, and probably more than 50% to blame if he did use a condom and she got pregnant anyway.
Plus, a contract that is unconscionable or unreasonable - like expecting a woman to control something she has no absolute control over, like reproduction or birth control failure - would probably be tossed.
if the clauses included any suggestion that the woman needed to have an abortion, it woyuld probably be tossed as a violation of her personal privacy.
Oh, and the right to child support is a right belonging to the child. The mother cannot sign it away by herself. In fact, in some jurisdictions, if the mother is not collecting support and goes on welfare, the welfare department will initiate support proceedings to recoup some of the welfare paid to support mother and child.
If you don’t want a child, have a vasectomy (which could fail too). Good luck trying to find a doctor who will do a vasectomy on a young male without children, for fear of a lawsuit 10 years down the road when he finally grown up and changes his mind…