No, slave labor was not used to construct the pyramids of Mesoamerica. However, corvée labor, or unfree labor, was mostly used by Mesoamerican peoples for construction (Abrams 1994). The difference between slavery and corvée labor is simple. Under slavery, a person is owned (permanently or temporarily) by another person and must do what is asked of them within the bounds of society's laws and rules. Corvée labor is a form of tax in which people are required to contribute a small amount of time to the state for public or royal projects. This labor is largely restricted to certain activities like construction of pyramids. Beyond the small amount of time one needs to contribute to the state, people are largely free to do what they want (within the bounds of society's laws and rules).
Even the largest pyramids in Mesoamerica, like the Sun Pyramid at Teotihuacan and the Great Pyramid at Cholula, were constructed using corvée labor. Both of this structures, mind you, were not constructed in one single construction event. Rather, both of these pyramids are created from smaller pyramids which were simply expanded. Each expansion of the pyramid, while itself an massive undertaking, reduced the amount of laborers needed during each construction season and created less of a burden on procuring construction materials in time for building. Instead of 5,000 people all trying to work on a pyramid and have it finished before the rainy season destroys the unsealed construction fill of earth, clay, or mud bricks, you can have a few hundred people work on a construction stage over the course of several years (or several decades and centuries depending on the pyramid).
While corvée labor may be used extensively by the nobility to construct their pyramids and palaces, people within Mesoamerica also constructed their own smaller pyramids and other buildings. Carballo (2012) has argued that the Aztec commoners used collective labor for their projects. Collective labor is essentially a group getting together to work on something for the betterment of the group. There is some corvée labor involved, but the demand for labor is not from an individual but rather from the community. The community expects aid in their construction efforts or other activities. That means helping someone harvest their crops, improve their house, or clearing a field of trees for a new farm. In return by contributing towards the community you can expect the same level of contribution from members of your community when you need something done that you cannot do yourself. Collective labor can be used to construct smaller neighborhood pyramids of lower quality. While the quality is not as nice as pyramids commissioned by nobility, a pyramid built by a community is still something greater than any kind of pyramid an individual may try and construct on their own.
I hope this answers your question.
Abrams, Elliot M. How the Maya built their world: energetics and ancient architecture. University of Texas Press, 1994.
Carballo, David M., ed. Cooperation and collective action: archaeological perspectives. University Press of Colorado, 2012.