Choice between transistor or relay
For 20Hz you should definitely use solid state switching. A typical 50-100K operations relay life will be expended in a day or so otherwise. Even if you derate substantially, it will be difficult to get more than a week or two life. 

You can use a MOSFET H-bridge to do this, however you will need to level shift your control signal to control the high side MOSFETs and you should prevent shoot-through caused by high and low MOSFETs being on at the same time. One chip that might prove useful is the LMD18201. It's designed as a motor driver, but it should work fine driving a solenoid provided the current is within the &lt;3A capability. It includes anti-shoot through circuitry and thermal protection. 



This particular part includes a charge pump for the high-side MOSFETs so it should work down to DC, unlike many of the common half-bridge drivers that depend on continuous switching to charge the boostrap capacitor supply.