In addition to purchasing level one defenses from the Market, you can also upgrade defenses that are in your town. This is critical to protect your town from high level players. You can upgrade any building in your town, with the exception of bombs. Tap the building, then press the upgrade button with the orange arrow at the bottom of your town. This will bring up a message detailing the upgrade benefits. If you're upgrading your Castle, you need to have a high enough experience level. If you're upgrading other buildings, you need to have a high enough Castle level. If you have enough gold, you can tap the upgrade button to send the building to your Workshop.
Mergers are a special case upgrade in whch you combine two one-square defenses into a two-square deense or combine two two-square defenses into a three-square defense, You'll know this action is available when the upgrade message shows that the next upgrade is a merger. If you have both defenses required for the merger, start the upgrade like you normally would. If you have enough gold, tap the upgrade confirmation button. You'll then be instructed to tap the defense in your town that's needed to complete the merger. The defenses will move to your Workshop for the upgrade.