Settlement at the site of Hirbiya dates back to the Canaanite period. It was known as "Forbie" to the Crusaders. In 1226, the Syrian geographer Yaqut al-Hamawi called it "Firbiya" and noted that it was within the administrative jurisdiction of Ascalon. The village was the site of a crucial battle, called the Battle of La Forbie, between the Crusaders and the Ayyubids, which ended in a decisive Ayyubid victory. Historians consider it second in strategic significance only to the Battle of Hattin in 1187. A circular well, made of masonry, and the foundations of a small tower was still found there in the late 19th century.
Ottoman era
Hirbiya was incorporated into the Ottoman Empire in 1517 with the rest of Palestine, by the 1596 tax records it was located in the nahiya of Gaza, a part of the Liwa of Gaza. It had a population of 160 households and 15 bachelors, an estimated 963 person, all Muslim. The villagers paid a fixed tax rate of 33,3 % on various products, including wheat, barley, grapes, fruit, and cotton; a total of 35,500 akçe. All of the revenue went to a waqf. In 1838, it was noted as located in the Gaza district. An Ottoman village list of about 1870 showed that Herbija had 58 houses and a population of 206, though the population count included men, only. In the late 19th century, Hirbiya had a rectangular layout, although some of its adobe brick houses were scattered in surrounding orchards. The village was surrounded by a pond, a well, and several gardens. To the south were remains of the Crusader fortress.
In the 1922 census of Palestine, conducted by the British Mandate authorities, Herbia had a population of 1,037 inhabitants, consisting of 1031 Muslims and 6 Christians, where all the Christians were Orthodox. The population had increased in the 1931 census to 1,520; 1,510 Muslims and 10 Christians, in 234 houses. Hirbiya had a mosque and elementary school, both located in the village center. The school opened in 1922 and had an enrollment of 124 students in the 1940s. In 1945 Hiribya had a population of 2,300; 2,200 Muslims, 40 Christians and 60 Jews, with a total of 22,312 dunams of land, according to an official land and population survey. Of this, 2,765 dunams were used for citrus and bananas, 6,106 dunams were for plantations and irrigable land, 2,037 for cereals, while 92 dunams were built-up land.
It is difficult to determine exactly when Hirbiya was occupied by Israel, although it was definitely targeted in October 1948 during Operation Yoav. The village came under aerial bombardment on October 15–16, along with a number of other towns and villages in the area. Later, during the same operation, an attack on the village was planned, but the attack was called off when Israeli forces learned that a large Egyptian Army force was quartered in the village. It probably fell to Israeli forces in early November, shortly after the occupation of Ascalon at the end of Operation Yoav. Following the war the area was incorporated into the State of Israel and two kibbutzim, Zikim and Karmia, were established on village lands in 1949 and 1950 respectively. The town of Yad Mordechai, established in 1943 has expanded onto Hirbiya's lands. According to Palestinian historian Walid Khalidi, "The mosque and the house of Muhammad 'Atiyya are the only buildings that survive."