Ondansetron is a medication primarily used to prevent nausea and vomiting caused by chemotherapy, radiation therapy, and surgery. It belongs to a class of drugs known as serotonin 5-HT3 receptor antagonists, which work by blocking the action of serotonin, a natural substance that may cause nausea and vomiting.