ANSWER: Divide the pills into three equal piles and narrow the choices by half or (roughly) thirds as appropriate with each weighing.
There are a number of solutions to this problem. Here is our solution:
Number the pills 1 thru 12. Now weigh pills 1, 2, 3, and 4 against pills 5, 6, 7, and 8. If the scale balances (the easier option) then the safe pill is either 9, 10, 11 or 12. Weigh pills 9 and 10 against pills 1 and 2 (known to be poison). If the scale balances again, weigh 11 against 1. If the scale balances yet again, 12 is safe. If the scale does not balance, pill 11 is safe. If pills 9 and 10 did not balance, then weigh pill 9 against pill 1 and use the same logic as for pills 11 and 12.
Now, if the first weighing did not balance, note which was the heavy side. The intent of the second weighing will be to divide the eight pills into three groups of three, three and two pills (this will also help you determine which of these groups contains the safe pill.) Then select the safe pill from this correct group on the third weighing. For example, let's say the heavy side was pills 1, 2, 3, and 4. Then weigh pills 1, 2, and 6 against 3, 4, and 5. This leaves three pills on the same side of the scale as in the first weighing (pills 1, 2, and 5) and moves three pills to the opposite side of the scale (pills 3, 4, and 6) and takes two pills off the scale (pills 7 and 8.) If the second weighing balances, then a pill not on the scale (pill 7 or 8) is safe and proceed as above.
If it does not balance and 1, 2, and 6 (which are on the same side of the scale) is heavy, then pill 1, 2, or 5 is safe (the three pills that were not moved.) Now weigh pills 1 and 5 against pills 3 and 4. If this balances, then pill 2 (not on the scale) is safe. If it does not balance, with 1 and 5 being heavy, then pill 1 (the pill not moved) is safe. If 1 and 5 is light, then pill 5 (the pill moved to the opposite side) is safe. If the second weighing did not balance and 3, 4, and 5 (the opposite side of the scale) is heavy, then either pill 3, 4, or 6 (the three pills moved to the opposite side) is safe and proceed as above.
Use similar logic if 5, 6, 7, and 8 was the heavy side of the first weighing.