There are a number of words in English with the suffix 'lock', eg padlock, deadlock, warlock, hemlock and wedlock, and many puns and jokes have been created based on the similarities, but the origin of the 'lock' of wedlock is different from that of the other words.
In 'wedlock', the suffix '-lock' is from the Old English -lác, which denoted a noun of action and meant 'action' or 'proceedings'. Wed was a pledge, so wedlock meant 'pledge-giving'. There were a handful of words in Old English with the suffix -lác, eg beadolác, feohtlác, heaðolác (warfare), and réaflác (robbery), but only wedlock has survived into modern English.
Not that wedlock is a particularly modern word. It means 'the state of being married' or matrimony, but usually appears these days in the phrase 'out of wedlock', itself a fairly old-fashioned phrase.
The 'lock' of padlock is from the Old English -loc, meaning lock. The same goes for 'deadlock', which was once a type of lock, as well as meaning a complete standstill. The word for the plant hemlock comes from the Old English hymlice. The -lock of warlock was -loga in Old English, which was related to the verb meaning belie or deny (the original meaning of warlock was oath-breaker).