Get in touch with your professor or teacher's aide as soon as you realize there's a problem. Putting forth this kind of effort will help get them on your side.
Try to work out a solution with your professor or TA.
Contact the student services office, or whatever office at your school provides academic advising to students.
Visit your professor's and/or TA's office hours as often as possible. Teachers appreciate students showing that they're involved and interested in improving.
Know your options: Keep abreast of deadlines for dropping classes and changing grading options.
Keep in touch with your professor and TA through the whole process. The more proactive you are, the more sympathetic your teachers are likely to be.