It is difficult to tell from your photograph, but it would appear that your guinea pig has a rectal prolapse. However, I note that you believe that your guinea pig's penis is involved.
Please keep your guinea pig separated from others; in a clean, soft, and dry enclosure; and check on him periodically, to ensure that he is not tampering with the exposed tissue.
The exposed tissue appears to be relatively healthy/not compromised, but you may wish to carefully check to see if there is a piece of hay, hair, or some other foreign body/material wrapped around the exposed tissue/that is causing the exposed tissue to swell.
Providing the exposed tissue continues to appear to be relatively healthy/not compromised, while not ideal, I would hope that your guinea pig could wait until 5 pm to be seen by the veterinarian without suffering any other ill-effects.
If you can get your guinea pig seen sooner, that would be better. If the exposed tissue begins to change colour/darkens etc…, please seek veterinary advice/attention ASAP.