A curvature of the penis - called chordee - is usually a birth defect, which is corrrected by surgery. If it bends suddenly, you should see your doctor to find out what's causing it.
There is a condition known as a "Priapism" which causes a previously straight penis to curve to one side. It is causes by calcification inside the penis, and can be cured with surgery.