Two possibilities which are coming to my mind are Fordyce spots and fixed drug eruption. Fordyce spots small, painless, raised, spots or bumps 1 to 3 mm in diameter that may appear on the shaft of the penis. The spots are a form of ectopic sebaceous gland, and are not known to be associated with any disease or illness and are of cosmetic concern only. They are non-infectious and a natural occurrence on the body.
To confirm the diagnosis please get an evaluation done from a dermatologist. It is very difficult to precisely confirm a diagnosis without examination and investigations and the answer is based on the medical information provided. For exact diagnosis, you are requested to consult your doctor. I sincerely hope that helps. Take care and please do keep me posted on how you are doing.