If you know the underlying cause of your cramps, you will likely have options to prevent them. If you have an IUD or your anatomy causes cramps, take ibuprofen or naproxen 30 minutes or longer before intercourse to prevent the inflammation that causes them.