I think Phillis Wheatley was motivated to write by her pure and simple need to express herself and her ideas. However, perhaps a secondary motivation would have been a desire to show the power of her mind to a population that would believe her to be incapable of possessing such intellectual prowess.
Wheatley wrote eloquently, alluding to Greek mythology, using elevated diction and a refined style. She used her considerable gifts to cast doubt on the popular beliefs concerning what a black person (or, by the laws of the time, 3/5 of a person) was able to do. In one poem, called "On Being Brought from Africa to America," Wheatley actually describes her enslavement as a "mercy" because it was her introduction to Christianity in America that "Taught [her] benighted soul to understand / That there's a God [...]." Moreover, she employs words with positive connotation, words like "benighted" and "sable," to describe her blackness, something so many would have considered to be a hindrance—something negative, not positive. The poem's message reminds Christians in America that, though "Negros [are] black as Cain, / [They] May be refin'd, and join th' angelic train." Her erudite and clearly purposeful word choices provide evidence that she could be considered "refin'd," and, combined with her description of enslavement as a mercy, underwrite her claim that slaves are equal in the eyes of the "Saviour." Thus, I think Wheatley used her need to write as well as her talent for it to show what she, and, by extension, other slaves, were capable of, thereby humanizing this group for a population that did not see them as human beings.