The treasury is a storage for the donations of the alliance members. With these donations, the treasurer can either upgrade the region, the treasury itself or increase the region bonuses. If the treasury is full, you cannot donate until the next Region Update. Also: Every player has a donation limit per cycle, which depends on the amount of habitats he controls. If this limit is reached, he cannot donate anymore. This also applies, if the donations are used for upgrading before the next Region Update.
Donations cannot be taken back or be paid out to players once they have been deposited. The conquest or loss of a region has no effect on the status of the treasury.
Special Case: Gold
If the alliance is disbanded, all members get their deposited gold back proportionally. So if three members donated 60, 30 and 10 Gold, they get back 6, 3 and 1 gold if the alliance had only 10 gold left at the breakup.
If you get kicked out of an alliance, you will get your share back. If you voluntarily leave the alliance, you will get your share back as well.