Can the boyfriend go to jail if he is 22 and the pregnant girl is only 17?

Probably not, since the age of consent in most places is 16, but the laws are different in each state. However, if it wasn't consensual he could go regardless of age.

It depends on the state. In most states the age of sexual consent is 16 (in some it's higher). If an adult has sex (even if it wasn't 'forced') with someone under the age of sexual consent then they have committed a crime. They can be charged, tried, and convicted. In the case of a child, it would be very easy (with a DNA test) to prove beyond any doubt that this man is guilty. Even if the girlfriend or her family didn't want to press charges, the state can still chose to press charges.