The short answer: it depends on your stage of pregnancy, so talk to your provider before using it. ACOG, the FDA, and the NHS advise avoiding ibuprofen from 20 weeks onward, when it can affect the baby's kidneys (lowering amniotic fluid) and, later, the ductus arteriosus in the heart. Earlier in pregnancy, occasional short-term use may be acceptable, but paracetamol (acetaminophen) is generally the preferred pain reliever throughout.
Ibuprofen is a common over-the-counter painkiller sold under names like Advil, Motrin, and Nurofen. It belongs to a group of drugs called NSAIDs (non-steroidal anti-inflammatory drugs), which also includes naproxen and aspirin. It's widely used for headaches, aches, and inflammation outside of pregnancy. The concerns here apply to the whole NSAID group, not ibuprofen alone.
The FDA recommends avoiding NSAIDs from about 20 weeks of pregnancy, because they can harm the baby's kidneys and lead to low amniotic fluid, sometimes after as little as 48 hours of use. ACOG advises not taking ibuprofen unless an ob-gyn recommends it, and only ever in the second trimester for short periods. The NHS treats it as not recommended in pregnancy, with a firmer warning from week 28 due to risks to the baby's heart and kidneys. Safety in early pregnancy is also not clearly established.
For most aches, headaches, and fever, ACOG and the NHS point to paracetamol (acetaminophen) as the preferred option, used at the lowest dose for the shortest time. Don't switch yourself from paracetamol to ibuprofen. If you took a dose of ibuprofen before you knew you were pregnant, try not to panic — a single early dose is unlikely to cause harm, but do mention it to your provider. Call your provider if pain is severe or ongoing rather than reaching for an NSAID.