They mostly were built by skilled laborers. The use of slaves is mostly myth. Good Hollywood & TV but not history. One could argue that everyone not the Pharoah was a “slave” of sorts. It’s clear it wasn’t the “slavery we think of. Historians still argue how much of it was a corvee system or not. Agricultural labor in Egypt was very seasonal (Still is!) so there’s people with “free time”. There’s considerable archeologically evidence that working on the pyramids was both an of religious devotion and a way of paying your taxes for the Egyptian peasant. There was no currency, labor was the only thing of value that could be easily exchanged.
I think there's a line in the Haggadah about "when we were skilled trade union masonry workers in Egypt." Or something like that. Oh, wait....
We were slaves to Pharaoh in Egypt, and the L-rd, our G-d, took us out from there with a strong hand and with an outstretched arm. If the Holy One, blessed be He, had not taken our fathers out of Egypt, then we, our children and our children's children would have remained enslaved to Pharaoh in Egypt. Passover Haggadah.
In Flavius Josephus's history, it is claimed that, after Ptolemy I Soter took Judea, he led some 120,000 Jewish captives to Egypt from the areas of Judea, Jerusalem, Samaria, and Mount Gerizim. History of the Jewish War (75–79) and The Antiquities of the Jews. Encyclopedia Britannica website.