The spelling is similar and the meaning so different. Wiktionary indicates that there might be some relation by linking to canon from cannon but I didn't see any specific statements regarding their relationship.

Are these related? How could they evolve into such different meanings?

canon (1)
"church law," O.E., from L.L. canon, in classical L.,
"measuring line, rule," from Gk. kanon "any straight rod or bar; rule;
standard of excellence," perhaps from [Greek] kanna "reed" (see cane). Taken
in ecclesiastical sense for "decree of the Church," and as such passed
through L.L. to O.E.

So cannon derived from Greek kanna "reed" (both are hollow tubes), and canon may have derived from Greek kanna "reed" (both are straight rules).

Even if these words are not connected, Anatoly Liberman's Word Origins And How We Know Them: Etymology for Everyone explains many other similar can- words are connected: cane as a walking stick, as a cane chair and as cane sugar are from a "hollow stem", from Latin canna "reed, cane, tube, pipe". Can "pot" via Latin canna "vessel", canal and channel are "pipes" via French, as is canyon a "pipe" but via Spanish. The Italian canellone and cannoli are "small tubes".

Semantically 'connected' words may not have common etymological origins, technically speaking. Words probably evolved from primitive sounds and considering such 'original' vocabulary to be extremely limited, every word is a cousin?
–
KrisFeb 2 '12 at 10:49

@Kris In the same way that all humans are related to each other, all words are probably also related to each other (unless language evolved separately in several places). But that’s going back more than 100,000 years, which is far beyond the limits of what we’ll ever be able to realistically reconstruct. The words mentioned in this answer are all related within the relatively short period of time that is the written history of Latin and Greek. That is about 50,000 per cent more certain and definite than ‘original’ (i.e., Proto-World) vocabulary.
–
Janus Bahs JacquetOct 9 '14 at 22:12

The earliest cannons (hollow iron tubes) were reinforced with bands spaced along their length to give added strength. The result gave the appearance of a reed (bamboo, sugar cane, etc.), thus the name. Measuring rods (slender, rigid, with marks uniformly spaced) had the appearance of reeds also, thus the word for cane was used to refer to a standard of measurement (canon).

It depends on which meanings you have in mind. Canon meaning, among other things, a rule, law, or decree and a body of writings is, through Latin and Old English, from the Greek κανών, meaning ‘rule’. Cannon meaning ‘gun’ has a quite different etymology. It has a core meaning of a tube, or cylindrical bore and has cognates in Provençal, Catalan, Spanish and Italian.

I can see the potential for a common root, in that one meaning of canon is a "measuring rod". Rod to tube isn't far.
–
slimFeb 1 '12 at 12:56

1

They both come from the same PIE root (Gk κάννα and La canna are clearly cognate), and the meaning is the same in both cases -- long rigid thing. I.e, reed, rod, rule, ruler (remember the first ruler you ever saw? In grade school?), cane, cannon, canon. Rules you have to follow refer to the rod that's hanging over you preparing to beat you if you don't. Louis XIV of France had Ultima Ratio Regum ("The final argument of kings") cast on the cannons of his armies.
–
John LawlerFeb 1 '12 at 17:39

@JohnLawler: If I could promote your comment to an answer, I would.
–
John YFeb 1 '12 at 17:55

Yes, I read that, too. But it doesn't tell me that they are unrelated. The Latin canna could very well have something to do with the sources of canon (perhaps because you used a measuring rod to determine the cannon's inner diameter? or because you use a cannon to enforce the law?)
–
bitmaskFeb 1 '12 at 12:52