How long do you have to smoke before getting oral cancer?

Unpredictable. Development of oral cancer depends on duration of smoking (the longer the more chance), quantity (the more you smoke the faster it will happen), oral hygiene (the better you take care of your mouth with twice daily tooth brushing and twice daily flossing the slower cancer will occur) and drinking alcohol also makes it happen faster. The risk of this type of cancer also increases with age.
Quit now. Usually it takes many years to decades. However in genetically susceptible people it may happen sooner. If you use tobacco, try to quit now. Smoking causes far more damage than just oral cancer.