From Liquipedia StarCraft 2 Wiki

Turtling is a term commonly used to describe very defensive play, in which the turtling player hides within your opponent's base building up heavy defenses. The term originates from the way turtles use their shell to defend against predators.

Turtling is most often employed by the Terran race, as the Siege Tank's splash and range, Missile Turret's anti-air capabilities, and the Bunker's durability in addition to the ability to be repaired make the Terran defensive incredibly resistant against enemy attacks and ideal for this style of play. However, both Zerg and Protoss races can also engage in turtle-style play with the use of their race-specific static defense buildings which include the Spine Crawler, Spore Crawler, and Photon Cannon, in conjunction with units such as the Mutalisk, Infestor, High Templar, and Sentry. It should be noted, however, that due to the Zerg race mechanics and overall composition it is less than optimal to engage in this style of play as the Zerg race.

Turtling can be countered by disabling the opponent player's ability to expand, slowly draining them of their ability to gain resources. It is also ideal for the non-turtling player to take advantage of the map control given to him/her as a result of the opponent's play style, and expand/tech accordingly.