In some animals, the male penis possesses a muscle enabling retraction into the prepuce.
In particular animals The retractor penis muscle occurs in marsupials and carnivorans, but it is absent in humans.Bassett, E. Gertrude. "Observations on the retractor clitoridis and retractor penis muscles of mammals with special reference to the ewe." Journal of anatomy 95.Pt 1 (1961): 61. A stag's penis forms an S-shaped curve when it is not erect, and is retracted into its preputial sheath by the retractor penis muscle.
In Tandonia, the retractor penis inserts at the boundary between the penis and epiphallus. "Genus summary for Tandonia". AnimalBase, last modified 23 May 2010, accessed 26 August 2010.
In stallions, the retractor penis muscle is relatively underdeveloped. The retractor muscle contracts to retract the penis into the sheath and relaxes to allow the penis to extend from the sheath.
In bulls, protrusion is not affected much by erection, but more by relaxation of the retractor penis muscle and straightening of the sigmoid flexure.
References