The GAP FAQ seems to be rather pessimistic about this:
8.1: Can I call GAP functions from another programme?
The short answer is no. To explain a little more fully, essentially
all the algebraic functionality of the GAP system is written in the
GAP language, and so needs the GAP interpreter to run. The interpreter
is written in C, but does not coexist happily with other code in the
same process for a number of reasons, so there is no sensible way to
link GAP into a C, Java or other program as a subroutine library.
There is some hope, though:
What you can do is to run GAP in a child process and communicate with
it using pipes, pseudo-ttys, UNIX FIFOs or some similar device. We
have done this successfully in a number of projects, and you can
contact the support list for more detailed advice if you want to go
down this route.
Update
The FAQ now also reads:
Relatively recently, some of the SAGE developers have produced libGAP, which allows the entire GAP system to be embedded as a C library. One still can't embed individual functions by themselves though and the first call to libGAP still has to invoke the full GAP start-up sequence.
Alternatively, there are a number of ways of running GAP as a server process and calling it from C of C++ programs. See the SCSCP package for the GAP side. There are several C and C++ libraries that implement the client side.