You take medication that has been tested on animals
The definition of veganism is: “Veganism is a way of living which seeks to exclude, as far as is possible and practicable, all forms of exploitation of, and cruelty to, animals for food, clothing or any other purpose”.
It is not practicable and possible to die or get ill because we don’t take medication we need. It is the law in the US, the UK and Europe that all medicine must be tested on animals before being released to the market, so vegans cannot practically avoid this since there aren’t any non-tested medicines.
But this is a different situation to eating animal products for pleasure and convenience when there are plenty of other options available at the supermarket. We’re not putting our health at risk when deciding to avoid animal products. Also, it is worth mentioning that buying the medicine is not actually increasing demand for animal testing since the medicine was tested before entering the market and never again, whereas animal products require animal deaths every time.