Alprostadil is a medication primarily used to treat erectile dysfunction (ED) in men. It works by relaxing the blood vessels and muscles in the penis, allowing more blood to flow in, which helps achieve and maintain an erection. Alprostadil is also used in newborns with certain heart defects to maintain the patency of the ductus arteriosus until surgery can be performed.