For men preparing for pregnancy, taking painkillers may have a certain impact on fertility. Some painkillers contain nonsteroidal anti-inflammatory drugs (NSAIDs), such as ibuprofen and aspirin, which may adversely affect sperm production and function.