Pillars were set up as memorial stones. They showed that something important had happened at that place and time.
In Hittite treaties, people called on their pagan gods to witness the agreement. The gods were believed to see and confirm the treaty.
However, the Hebrews were not allowed to recognize other gods. Instead of calling on false gods as witnesses, they used stone pillars to mark the agreement.