Here you will find some examples to directly control the GPIO pins of the raspberry that you have openhab installed on. A simple search for “GPIO” on the forum that you could have done yourself, would have brought that up:
If you want to use the GPIO pins of a raspberry that your openhab is not installed on, have a look here:
Once you can control the pins, all you need to do is hang a relay on them and start making rules to switch the relays on and off.