To identify who were the captives, we need to recall that older Midianite males were killed in the war with Midian, Bamidbar 31:8. The captive women and their children were brought to the Jewish camp Bamidbar 31:9. Verse Bamidbar 31:17 states that Midianite women and male children were all killed, Kli Yakar explains why all male children were killed (1). The remaining captives, thus, refer to young girls under 3 years old (Yebamos 60b), who where identified by Tzitz as not fit for relations. Women older than 3 had their face turn yellow (or green) when examined by Tzitz (Tosafos there, Rashi on Bamidbar 31:17 quoting Sifrei Bamidbar 157:6).
Gemara Yebamos 60b explains that according to the opinion of R. Shimon b. Yochai these girls were fit to marry kohanim, because the verse Bamidbar 31:18 has the word לָכֶֽם. For example, Pinchas as a cohen would be allowed to marry any of these girls, just like other Jewish men. However, halacha is not like R. Shimon, the opinion of Rabbanan follows the verse Yechezkel 44:22 which excludes female converts altogether from marrying kohanim. According to this opinion, the girls were raised as maidservants. The explanation of the position of Rabannan is discussed by Rishonim. (Thank you, Meir!)
The fact that 32 of these girls were given as Teruma, meant that they were given to the families of kohanim to be raised and either possibly get married into the family according to R. Shimon or be the family maidservant according to Rabbanan.
(1) Rabbi Kaii offers a beautiful and detailed explanation of Kli Yakar.