"A sound law refers to the treatment of a sound only under certain given conditions, in particular environments, so that if the sound in question occurs in a word under conditions other than those stipulated by the law, then the law will not apply." (Palmer, p. 209) "A sound law can only refer to a small linguistic group in which there exists for all practical purposes uniformity of speech. Thus each dialect will have its own peculiar set of sound laws" (Palmer, p. 211) In contrast to the sound law, dialect mixture and inter-borrowing can account for many pairs of words which negates the sound law. Some examples are the following words where each pair ultimately has the same source and have changed due to different sound laws: 1) shirt, skirt; 2) school, shoal; 3) no, nay; 4) ship, skiff.
Fixed laws in sound change were posited by Wilhelm Scherer in his book on the history of the German language (Scherer, 1868) and that became a major tenet of the Neogrammarian school of thought which dominated linguistic inquiry after 1868 (Malmkjaer 1991 p.194). When some data did not accord with Scherer's theory of phonetic laws for sound change, a concept of 'analogy' was used to explain anomalies. Analogy is the speakers tendency to become more regular in phonology and syntax. That seems like an attempt to make the data some how conform to some aspect of a regular sound law. I would prefer to explain anomalies by the explanation in the previous paragraph which notes the mixing of dialects as the cause.
The following quote is referenced to a map of dialects with respect to the contrasting words chandelle (candela), chanter (cantare), champ (campus), chambre (camera). The map simply shows overlaping (noncorresponding) issoglosses (dialect boundries) of the dialects in question in France, after Jaberg, Sprachgeographie, Aarau, 1908. "In the first place we must consider the verdict of dialect geography upon the sound law question. At first sight the dialect map seems to deal a crushing blow to the Neogrammarian dogma, for no two words seem to have exactly the same sound treatment. It shows the treatment in French of Latin words in which an initial k sound is followed by the vowel a. In standard French it usually becomes /sh/ (e.g. caldum > chaud /sho/), but the k is preserved in certain dialects in the north and south. On the dialect map a line is drawn enclosing all places which have the same sound treatment. Such a line is called an 'isogloss'. Figure 37 is a composite map made by superimposing the maps of the words chandelle (candela), chanter (cantare), champ (campus), chambre (camera). It will be seen that in the center of France the k under these conditions regularly becomes ch, but that in the north and south, where it is preserved, the lines of the different words do not exactly coincide. That is to say that in some dialects on the border of the k-territory and the /sh/-territory the treatment varies from word to word, so that in these dialects there can be no talk of rigid sound laws. The experience derived from such dialect studies led Gillieron and his followers to deny the truth of the sound law dogma, and to condemn it as an artificial and sterile approach to linguistic problems." (Palmer, p.272) "Such facts, however, do not invalidate the dogma of sound law inviolability propounded by the neogrammarians; for they, too, had envisaged the possibility of dialect intermixture and borrowing providing apparent exceptions to the sound law. All that dialect geography has done is to show that such borrowing takes place far more frequently and intensively than we had supposed." (Palmer, p.277) That last point lends support to my emphasis on word borrowing as a cause of linguistic change. Note that it also accounts for anomalies against the regularity of the sound law.
Others have viewed linguistic change as due to language mixing. "Hugo Schuchardt (1842-1927) of the University of Graz published an atricle in 1885 on the sound laws in which he considered language change to be due to a mixing process both within and outside language. Similarly, Ascoli (1829-1907) attributed much of the process of language change to a theory proposed by him called the Substratum Theory, in which languages were influenced by mixture of populations." (Malmkjaer, p.194) Both of those views accord with my understanding of historical linguistic change.
Dialect maps "show plainly how words are radiated from centres of culture and administration and how the standard literary languages gradually replace the patois of the countryside." (Palmer, p.283) One example is as described above on the dialect map of France we noted the irregularities on the periphery northward and southward around, while much regularity in the body of the country as around Paris. This emphasis on the typical spread of a literary language emphasizes the importance of orthography in solidifying a defining step in historical linguistic change. Ultimately it is the writings which provide evidence of those orthographies. To understand old linguistic change we must not only understand the writing, but we must understand the orthographic rules of that writing as well.
In summary we can say a few things about dialects in connection with sound laws and linguistic change. Dialect mixture can cause apparent exceptions to a sound law. Dialect geography shows borrowings to be frequent, and that occurs in the process of dialect mixture. Some scholars base their theory of linguistic change on language mixing. The spread of literary languages tends to smooth out the irregularities of diverse dialects.
References:
Malmkjaer, Kirsten, 'The Linguistics Encyclopedia', Routledge,1991.
Palmer, Leonard R., 'Descriptive And Comparative Linguistics A Critical Introduction', New York, 1972.