If she obtains a F1 visa before she gets divorced, then she should not have a problem remaining in the U.S. on her F1 visa and remarrying while present on that visa. If the divorce is complete before she has a F1 visa, she won't be in lawful immigrant status and thus can expect to be denied a F1 visa unless she first leaves the U.S.
She will benefit from discussing her plans and options with an immigration lawyer.

