Your foreskin doesnt automatically retract for most men
it depends on the length of your foreskin, if you have a foreskin that is normal to large then when u get an erection it will most likely stay forward
if u have ashort foreskin it may come back
ive been keeping my foreskin back, on and off for 6months now, if u do thsi a lot the ridge ofyour penis will become larger and help keep the foreskin back, it will also stretch ur frenum which is responsible for pulling ur foreskin forward
hope this helps