Yes but not for long
A woman's breast is squeezed as flat as possible for a couple seconds while the x ray is taken.
It hurts, but it doesn't last long. Most women have no problem tolerating it. It shouldn't keep you from having it done if your doctor recommends it.