Ceramics from the Byzantine era have been found here. The village had tombs of people who were killed while battling the Crusades, according to the villagers. The local mosque had an inscription dating to 645 AH.
Ottoman era
Ni'ilya was incorporated into the Ottoman Empire in 1517 with the rest of Palestine, and according to the 1596 tax records, the village formed part of the nahiya of Gaza, part of Gaza Sanjak, with a population of 70 households and 10 bachelors, or an estimated 440 people. All were Muslims. The villagers paid a fixed tax-rate of 33.3% on a number of crops, including wheat, barley, summer crops, vineyards, fruit trees, sesame, as well as on goats, beehives; a total of 20,780 akçe. Pierre Jacotin noted it as an unnamed village on his map from 1799. In 1863 Victor Guérin found it to be a village with 300 inhabitants. The village had a mosque which contained ancient fragments, such as trunks of marble columns. An Ottoman village list from about 1870 showed that Na'lija had 39 houses and a population of 111, though the population count included men, only. In 1883 the PEF's Survey of Western Palestine described Ni'ilya as a village resembling Barbara. They further noted: "A very extensive olive-grove extends thence to Majdal. On the south is a conspicuous white Mukam."
In the 1922 census of Palestine conducted by the British Mandate authorities, Na'lia had a population of 687 inhabitants, all Muslims, while in the 1931 census, Na'lia had 169 occupied houses and a population of 893 Muslims. In the 1930s the village mosque was inspected by Mayer from the Department of Antiquities. His report said: "Mosque on sand dune outside village on the South. S. and W. walls entirely covered by sand. The mikhrab is flanked with two marble shafts and inscription on a fragment of column is placed over the column on the left side. Waqf property. The mosque is still in religious use. Inscription in ordinary writing, 8 lines, irregular height of letters. Measurement of the inscription, 0.38m by 0.31m breadth over concave surface. Date given 645 AH. The inscription could not be photographed." In the 1945 statistics this had increased to 1310 Muslims, with a total of 5,233 dunams of land. Cultivated lands in the village in 1944–45 included a total of 1,084 dunums used for citrus and bananas, 2,215 dunums for cereals. An additional 1,436 dunums were irrigated or used for plantations, while 29 dunams were built-up, urban, land. Ni'ilya students attended school in al-Majdal. A school was built in the village in 1948 shortly before the war but never opened. The village also had a mosque.
1948, aftermath
Ni'ilya was one of the villages named in the orders to the IDF battalions and engineers platoon, that the villagers were to be expelled to Gaza, and the IDF troops were "to prevent their return by destroying their villages." The path leading to the village was to be mined. The IDF troops were ordered to carry out the operation "with determination, accuracy and energy". The operation took place on 30 November. The troops found "about 40" villagers in Barbara and al-Jiyya, "composed of women, old men and children", who offered no resistance. They were expelled to Beit Hanun, in the northern Gaza strip. Eight young men who were found were sent to a POW camp. Since the war, Ashkelon has expanded onto village land. In 1992, the village site was described: " The village has been obliterated, and the site is overgrown with wild plants and a few sycamore trees. One house that had probably been built in a fruit orchard still stands and is currently inhabited by a Palestinian family. It has a flat roof and rectangular windows and door. The land in the vicinity is cultivated by Israeli farmers."