Incomplete pollination of the female flower will cause deformed, curved growth. To fully pollinate a flower, a bee must come to a flower 8-12 times. Drought, stress and being grown on the ground can also cause this issue. This does not affect the taste and are still fine to eat.
Training plants on a trellis is the best way to ensure long, straight cucumbers.