Great question - typically we find that students are best-served to take the GMAT about three weeks after the end of class, so that they have the opportunity to take a few practice tests, catch up on homework, and shore up any weak areas.
As far as registration, there are a few answers to that:
1) In the spring, you have a little more flexibility as fewer people are taking the exam and accordingly there is greater seat availability.
2) In the fall, seats tend to fill up quickly, so you may want to look at registering earlier.
3) A general recommendation (time permitting) - if you plan out a study schedule in advance of your class, you can check about three weeks in to class just to make sure that you've adhered to it, and then register for your exam at that point. That way, if you've been lax at all in getting to homework, or just feel that you're not making the progress as quickly as anticipated for whatever reason, you can readjust your study plans to take the exam a week or two later than initially planned. If you're on schedule, you can confidently register for the exam and continue studying with a slightly increased sense of urgency.
4) One other item worth mentioning - if you do need to reschedule your test date, you can do so with only a $50 penalty up to a week prior to your exam. If you reschedule within a week, you are responsible for the entire $250 fee. In that case, you might as well treat the exam like a very expensive practice test, as you've paid for it anyway (and still have an opportunity to succeed).