How long does medicine have to stay in a person's stomach to become effective?

Depends on the med. This is dependent on the medication. Typically medications may spent 20-30 minutes in the stomach after spending 10-15 minutes in the esophagus. Some medications sit there longer and get absorbed because of stomach acid.