From what I read so far in this board and from what I heard, there are 2 types of green card.
Conditional Green card and Regular Green card. One of the way to find out if you have a conditional green card is that it will expire in 3 years instead of 10 years.
I am guessing you have a regular green card. In either case, you dont have to leave the country. Your green card is not affected by the divorce, incase you have a conditional green card, I think, when you apply for renewal (after 3 years) you have to show your financial independence and they will renew. If you have the regular green card, you dont have to worry about anything.
Good luck and talk to a lawyer if you are in doubt.