The ecliptic was understood to be the path of the sun relative to the sky.
Ptolemy believed the sky rotated daily around the Earth. All the planets, including the Moon and the Sun, shared in this motion.
However, the planets had secondary motions, relative to the sky. And in particular relative to the stars that they thought were fixed to the sky. This motion was discovered by careful observations of the sky, and was very well known, long before Ptolemy.
The motion of the stars was very simple: therefore when Ptolemy was describing his system, he only concerned himself with the motion of the planets (including the moon and sun) relative to the stars. It was clear that the planets all approximately followed a great circle relative to the stars. This great circle is the ecliptic. The Sun's motion was the simplest. It was exactly on the great circle, and it's position relative to the stars moved almost evenly. The other planets (including the moon) had orbits that were less even, but by introducing a system of Eccentrics, Deferents, Epicycles and Equants, Ptolemy was able to account for nearly all their motions.
The precession of the equinoxes was noticed because the Greeks used a calendar based on the heliacal rising (the date that stars are just visible before sunrise) of certain stars. And it was noticed that the heliacal rising was changing relative to the seasons and the equinox. We understand the reason for this to be the precession of the equinoxes.