In ROS-1, the user code would connect to the ROS client libraries (such as rospy or roscpp) and they would communicate directly with other nodes from within the network, whereas in ROS-2, the ROS client libraries act like an abstraction layer and connect to another layer that communicates with the network using other nodes through DDS implementation. A simple comparison is shown here:
As you can see, in ROS-2, the communication with the OS layer and further down to the hardware layer is done through DDS implementation. The DDS component in the preceding diagram is vendor-specific and implemented by the vendors.
The abstract DDS layer component is connected via ROS-2 and helps the user connect their code through DDS implementation. This way, the user need not be explicitly aware of the DDS APIs as they come through ROS-2...