How does a diaphragm work in the body?

As a barrier. The diaphragm acts as a barrier to prevent sperm from getting into the uterus and joining with eggs to prevent pregnancy. Diaphragms should be used with a spermacide gel or cream to make them more effective.