The question depends on how a shul is viewed. As private property owned by the people who donated towards it or as "Hekdesh" If a shul is considerd "Hekdesh" the the rule "Ein Yad LeHekdesh" applies and a automatic kinyan can not be made just by being left in the shul. [ Tosafot explians the the reason for the distinction of "Ein Yad Lehekdesh." The fact that a person's domain can effect an acquisition is because it is considered an extension of his hand; yet Hekdesh has no hand to "extend.] Therefore all items left in a shul (according to this view) still belong to their original owners and the Gabbaim have no right to throw them out.
For that reason many Shuls put up a sign like @andrewmh20 mentioned to get around this issue i.e. by entering the Shul you do so on the condition that if you forget anything then after 30 days the Shul can dispose of the item.
Here is the best i could do for a source at this time.
OWNERSHIP OF A SHUL - REDUX