Ibuprofen belongs to a group called NSAIDs (non-steroidal anti-inflammatory drugs). These are usually avoided during pregnancy. From about the 20th week and particularly in the last trimester, they can affect the baby's circulation and kidneys and may reduce amniotic fluid, so they are generally not recommended in later pregnancy.
In early pregnancy the picture is more nuanced, but most clinicians still steer away from routine NSAID use and recommend paracetamol instead for pain or fever. Occasionally a specialist may prescribe an NSAID for a specific medical reason, but that is a decision made and monitored by a doctor.
If you took ibuprofen before you knew you were pregnant, don't panic, but stop and let your doctor know. For ongoing pain, ask your clinician or pharmacist about safer alternatives rather than continuing on your own.