There are three C source-files in play: mempool, foo1, foo2.
The .h file(s) are header files which describe what the functions "look like," and how they are to be called.
When you compile either foo1 or foo2, the object-code from mempool.o will be statically linked into them.
Having done this, they are now "two entirely separate programs," both of which contain an identical bit of object-code.
When the two programs execute, each of them will have their own private heap. Although both of them contain the same object-code that is used for memory-pool management, they are unrelated to one another.
If you do want the programs to actually "share memory," you must use a named shared-memory segment. (shmget, etc ...), and you must design your memory-pool manager code to find, open, and properly use that shared resource. Once again, both programs will contain their own independent copy of the object-code of your memory-pool manager.
(Hint: "this has already been done." You can find complete libraries that do this, on places like GitHub, instead of embarking on a custom-made implementation, yourself.)
===
Additional Note:
I would also like to comment, in passing, that a third possibility exists: dynamically-loaded libraries.
When you take this approach, the object-code is loaded by the application at runtime, and it does not become "part of" the object-code of the applications that use it. Instead, it becomes accessible to them. Furthermore, the operating system is aware of the sharing, and it may recognize a single instance that is being shared. It may allow a common set of memory-allocations to be "owned by" that single, shared instance. Operating-systems (and versions, "historic vs. modern-day" e.g. of MS-Windows ...) vary on this particular point.
malloc& friends is a very bad idea. That's the reason one uses memory pools ...