The science fiction usage is derived from its original meaning:
1630s, "capable of feeling," from Latin sentientem (nominative sentiens) "feeling," present participle of sentire "to feel" (see sense (n.)).
Meaning "conscious" (of something) is from 1815.
The term is commonly used in Buddhism for instance:
In Buddhism, sentient beings are beings with consciousness, sentience, or in some contexts life itself. Sentient beings are composed of the five aggregates, or skandhas: matter, sensation, perception, mental formations and consciousness.
Sentient in science fiction:
In science fiction, an alien, android, robot, hologram or computer described as ‘sentient’ is usually treated in the same way as a human being. Foremost among these properties is human level intelligence (sapience) but sentient characters also typically display desire, will, consciousness, ethic, personality, insight and humour. Sentience is used in this context to describe an essential human property that unites all of these other qualities. The words ‘sapience’, ‘self-awareness’ and ‘consciousness’ are used in similar ways and sometimes – and confusingly –interchangeably in science fiction.