With regards to the controllers, definitely. Check the documentation: https://retropie.org.uk/docs/GPIO-Modules/#gamecon_gpio_rpi
Power buttons are a bit more difficult, as the Pi needs to be shutdown cleanly, you can't just rip the power away and expect it to be fine next time (sometimes it is, but not always). You could create a custom shutdown script or use something like the PowerBlock or actually, to combine the function you could use the ControlBlock https://blog.petrockblock.com/controlblock/
Si