Wearing a chastity cage will not prevent the body's natural functioning, which includes erections. This is especially noticeable during sleep, when erections are involuntary.
When you start to get an erection, the cage will partially restrict it, compressing the penis and redirecting the erection downward (rather than out and up). However the penis will still grow when this happens, and it's normal for the cage to get pushed out away from the body as a result.