Omeprazole is primarily metabolized in the liver by the cytochrome P450 enzyme system, particularly CYP2C19 and CYP3A4. The metabolites are then excreted mainly through the urine. Genetic polymorphisms affecting CYP2C19 can lead to variations in drug metabolism, influencing both efficacy and toxicity. This variability underscores the importance of personalized medicine in optimizing therapeutic outcomes and minimizing adverse effects.