Drinking coffee through a straw will prevent coffee from touching your teeth. If you pack a toothbrush with your straw your teeth will not sit in coffee and get stained.
Stains occur when the coffee passes over your teeth, depositing 'color' over time. Using a staw limits the amount of coffee touching your teeth and reduces staining.
While is can (and is suggested)help prevent staining, I'm not sure I would drink a hot beverage through plastic. It does allow the beverage to bypass the teeth.