1640s, a legal word, "held through the favor of another," from Latin precarius "depending on favor, pertaining to entreaty, obtained by asking or praying," from prex (genitive precis) "entreaty, prayer" (from PIE root *prek- "to ask, entreat").
The notion of "dependent on the will of another" led to the extended sense "risky, dangerous, hazardous, uncertain" (1680s), but this was objected to. "No word is more unskillfully used than this with its derivatives. It is used for uncertain in all its senses; but it only means uncertain, as dependent on others ..." [Johnson]. Related: Precariously; precariousness.