I'm not the first one to have thought of this and there are many ideas as to how to do it. Presented below is my take on an ST-4 compatible autoguiding interface. It plugs into the Pi's 40 pin I/O connector and sticks out of the case so as to allow the cable to connect from the guide port on your mount to the Pi. I've also added a DSLR trigger too.
I've uploaded the board to Oshpark so that you can order one (well, 3 really). The BOM is trivial and the opto chips are nothing special.

Below are the Eagle files.
RPi_ST-4_Opto_Interface.brd
RPi_ST-4_Opto_Interface.sch