The snake-inspired robot is a multi-joint, highly flexible biomimetic robot. It can adapt to narrow underwater environments and is widely used in hazardous environments that cannot be reached by humans, such as disaster rescue, underwater reconnaissance, and sewage detection. The snake-inspired swarm robot modularized designed in this article has strong scalability. It greatly improves the working efficiency underwater. Two deployment modes can be used for different environmental conditions: the grouped mode and the separated mode. In the grouped mode, the snake robot mimics the swimming motion of a biological snake underwater and generates propulsion thrusts by fluctuating the whole body. This mode is more energy-efficient and safe compared to propellers. In the separated mode, the snake robot will split into nine sub-units, each of which is individually propelled by a propeller and can achieve attitude control. This mode effectively reduces the size of the single robot, making it easier to enter the narrow space. Meanwhile, distributed deployment of the swarm units increases the efficiency of conducting underwater tasks. The snake body is controlled to separate and combine through electromagnets.