This is called priapism
and is an emergency.
The biggest problem is that the blood in the penis can clot and otherwise restrict circulation to the organ. This can result in permanent damage and permanent erectile dysfunction
. It can be caused by a variety of things and requires emergency treatment to prevent damage.
Answer assisted by David Miller, Medical Student