TCP is a communication protocol working on the so-called "Transport Layer", layer 4 of the ISO/OSI Stack. This basically means that it is a protocol defined to carry any arbitrary data over another protocol.
In the ISO/OSI stack, basically, it works like this: Data from the application layer (7) is encapsuled in protocols from lower layers (6 and 5, but mostly layer 4) and then sent over a protocol on a lower level (mostly layer 3). Layer 2 and 1 will take care of the physical transmission.
As an example, data could be sent over HTTP (let's say a website). This is layer 7. The HTTP data will be encapsuled in TCP (layer 4). The TCP data again is encapsuled within IP, which is a protocol of the "Network Layer", layer 3 (and therefore can carry any other data from above layers).
But: There are several other protocols, you could even define your own. A well-known counterpart to TCP is UDP, which is targeted towards non-reliable communication and realtime applications like video conferencing or gaming.
IP is very dominant, but still there could be an arbitrary number of other protocols. For example ICMP is famous for being used in the ping command.
So, to summarize: Two machines do not need to communicate over TCP/IP. In a practical situation they could use, for example, UDP. IP could be replaced too, but that's probably too hard to implement as all current operating systems' networking functions are all based on TCP/IP communication.