Yes, this is possible and very easy to implement in any language.
Because Twilio is a "toolbox" API, you build the logic with the "tools" to provide communication between the two partners, using the Twilio phone number as the intermediary, thus keeping each partner's number private.
Assuming you already know both the phone numbers that you want to connect:
- An SMS arrives from one phone number to your Twilio number.
- You perform a database lookup to see which phone number needs to receive the message.
- You create a new SMS with the Twilio REST API to the receiving phone number, from the Twilio phone number.
This exact procedure works both ways. You can also replace SMS for voice.
I've deliberately not written this in code as I believe an explanation of this particular process is better than a code dump.