The current max level is 8.
"The heart of Skyland. Upgrade to add more defense units to defend the town."
The higher your castle's level is, the higher the defense cost gets. You can "store" warriors inside the castle at a cost equal to its defense cost.
If there are more than 1 warrior in defense deck slot, when the first one died, the next warrior will go out of the castle and continue fighting on the battle.
The castle will also help to save an amount of your resources after your town get attacked.