Old English hwile, accusative of hwil "a space of time," from Proto-Germanic *khwilo (cf. Old Saxon hwil, Old Frisian hwile, Old High German hwila, German Weile, Gothic hveila "space of time, while"), originally "rest" (cf. Old Norse hvila "bed," hvild "rest"), from PIE *qwi- "rest" (cf. Avestan shaitish "joy," Old Persian šiyatish "joy," Latin quies "rest, repose, quiet," Old Church Slavonic po-koji "rest"). Notion of "period of rest" became in Germanic "period of time."
Now largely superseded by time except in formulaic constructions (e.g. all the while). Middle English sense of "time spent in doing something" now only preserved in worthwhile and phrases such as worth (one's) while. As a conjunction (late Old English), it represents Old English þa hwile þe; form whiles is recorded from early 13c.; whilst is from late 14c., with excrescent -st as in amongst, amidst (see amid).