Priapism is a painful medical condition where the penis remains erect for a prolonged period of time without being stimulated. The blood that enters the penis to cause the erection doesn't leave it and return to the body. It is considered a medical emergency that, without prompt treatment could cause permanent damage to the penile tissue. It could possibly leave it incapable of achieving or maintaining an orgasm.
More About Priapism
Advertisements for erectile dysfunction medications often advise seeking medical treatment for "erections lasting longer than 4 hours." However, there is some controversy as to what length of time is actually considered dangerous for priapism. Technically, the criteria for priapism dictate that an erection last over 6 hours.
The condition is named for the Greek fertility god Priapus who is typically depicted with a large erection.