He can marry his girlfriend but that probably won't help with his visa problem. He obviously entered with the intention to go to another country after the US otherwise he would not have had the onward ticket.
He needs to contact an immigration and naturalization office. The best way is to allow a day to go and sit to ask someone face to face. make sure his American girlfriend goes with him.
You can pay an immigration attorney if you can afford one. But no guarantees what the eventual outcome will be.