The earliest documentary evidence relating to Persian carpets is found in Chinese texts dating from the Sassanid Dynasty (224 - 641), who were the last native Persian rulers before the Arab conquest. History tells how the Sassanian capital of Ctesiphon (just south of modern day Baghdad) was home to some of the most fabulous carpets ever made.
Several hundred years of domination by the Arab Caliphates was ended with the Seljuk invasion of Persia in the mid 11th century. The Seljuk rule, which lasted until 1194, had a profound influence on carpet weaving in Iran. The Seljuk weavers had well developed skills and used the "Turkish" (or "Gördes") knot. In areas where the Seljuks were most influential (western Iran and Azerbaijan), this knot replaced the Persian "senneh" knot, and is still used there today.
It's likely that the first Iranian rugs were woven by nomads, but the oldest surviving complete rugs (excluding the Pazyryk carpet mentioned above) are those of the royal courts of the Safavid Dynasty (1501 - 1736). These "court rugs" are typified by intricate designs and extraordinary craftsmanship, often using silk and metal-thread in the weaving.
The "court period" of carpet weaving came to an end with the Afghan invasion of Iran in 1722, and the destruction of Esfahan, the Safavid capital. A long turbulent period followed, and it wasn't until the second-half of the 19th century, during the Qajar dynasty, that the craft of carpet making recovered.
Towards the end of the 19th century, there was a flourishing of carpet exporting to Europe and North America (mostly through Istanbul), with some European companies setting up offices & production in Iran (Ziegler & Co. of Manchester, for example).