Yes! It's quite common for runners to change shoes, socks, shirts, etc. in the middle of a race. If you feel that it would be helpful for you then try it out in training and then implement it in some race.
Update: answering @Pacerier's question
Ultras have regular aid stations where you can get water (at least) and food. Many ultras will note particular aid stations as having drop bags. You give a bag to the volunteers at the start and it will arrive at that aid station (hopefully). Alternatively, you might have crew who will drive from aid station to aid station and help you out.
It's important to read the racer manual for a particular race and consider your plan.