The 24-year-old put pen-to-paper on a two-year deal at Griffin Park less than 24 hours after Simon Moore left the club to join Premier League new-boys Cardiff City.
Button started his career with Tottenham but didn't make a senior appearance and had 13 spells on loan with lower league clubs before joining Charlton last summer.
Bees boss Uwe Rosler told the club's official website "We always felt we had to have a Plan B in place in case we had offers for Simon Moore.
"Over the summer we had goalkeepers in on trial and we made lists and enquiries in case Simon left. That happened this week and with Simon going out the door, there is an opportunity for someone to come in.
"We decided David was the perfect choice for us. He is at the right age and he is very hungry to make the number one spot his own. As soon as Simon left, David was our first choice.
"He is the only player we enquired about and the only player we made a bid for. We did not at any stage make any enquiries or bids for any other goalkeepers.
"David will face strong competition for the goalkeeper spot from Jack Bonham and Richard Lee, when Richard is fit again. We are very strong in the goalkeeper department.
"We have been strong there over the past two seasons and are even stronger this year."