I will give you my favorite answer: When it is most convenient for you.
Here are a few thoughts to add to that simple answer. Try to think about the calendar, holidays, trips, work, family; then add in your due date. Even though I am not a huge fan of focusing on that one date it does help offer a framework for timing. I suggest completing your classes by 36 weeks of pregnancy. But if 36 weeks lands on December 20th then you better plan to take classes in November! I find September and January due dates tend to be the toughest. Private and Hospital classes alike often scale back their offerings in summer and around the winter holidays.
Start looking for a class that suits you as you begin your 2nd trimester. Call around, talk to the instructor; make it convenient and enjoyable. We have a lot of students take our weekend class on the early side then come back closer to their due date to have a “dress rehearsal” with our Comfort Measures workshop. Often a couple will get through a one morning class at their birthing hospital to find out it was not quite as robust as they had hoped, it is never too late to hop into another class. While I recommend finishing by 36 weeks, statistically speaking 1st time moms usually can get in a class as late as 39 weeks with no problem.