"in or within which or what," early 13c., from where (in the sense of "in which position or circumstances") + in. Similar formation in Dutch waarin, German worin, Swedish vari, Danish hvori.
whereabouts
whereas
whereat
whereby
wherefore
wherein
whereof
whereon
whereupon
wherever
wherewith