1. We had to cook the turkey for six hours.

2. We had to cook the turkey in six hours.

3. We had to cook the turkey until six hours.

4. We had to cook the turkey from six hours.

5. We had to cook the turkey after six hours.

(#1 is right? What about the others? If we use other prepositions, can't we make correct sentences? Would you let me know what other prepositions we can use? Thank you.)

Yes. # 1 is right. It took six hours of cooking for the turkey to be completely cooked.

The other sentences have different meanings -- but are not usually used.