Pharmacies (Apotek) are present all around the country and are open during usual shop opening hours (10:00-18:00 on weekdays and 10:00-14:00 on Saturdays, this can vary locally). In every major city you will be able to find a 24h pharmacy. The 24h health information number is the 1177.
Most medicines, except benign one such as aspirins, need a prescription from your doctor. You will need to pay your medicines in Sweden. If you are a Swedish resident, the amount you pay will be topped at a ceiling of SEK 1,800 during each twelve month period (does not apply to European health card holders).