How can you get oral cancer?

Varies. The common squamous carcinomas of the oropharynx are most often caused by tobacco, with alcohol and perhaps viruses often contributing. Others such as the minor salivary gland cancers seem to just happen by dumb luck, random genetic damage.
Smoking, drinking. Oral cancer can be from excessive drinking and smoking, including smokeless tobacco, and excessive sun exposure (use sunscreen and lip balm). There is also a genetic component to oral cancer risk.