For a seemingly simple question, the answer can be quite complex. The short answer is, it depends. I am not an immigration lawyer, but I am quite familiar with nonprofits. Current immigration regulations will allow an H-1B visa holder to "work" for anyone other than the employer(s) who sponsored their H-1B visa. Many people who ask this question are quick to state that they will be unpaid volunteers, but, surprisingly, this does not necessarily make a difference. The question is also whether the H-1B visa holder will nonetheless be performing "work" for the nonprofit.
Generally speaking, the United States Citizenship and Immigration Services (USCIS) considers any type of engagement for which somebody, under normal circumstances, would be paid as "work." So, for example, if an H1-B visa holder volunteered to help at a nonprofit arts function moving around stage props for a free public performance, that would not be considered work, but if he or she ran the nonprofit as it's Executive Director, then that's another story. Ordinarily, the position of Executive Director is a paid position and one of significant day-to-day responsibility for managing the affairs of the nonprofit. Therefore, that position or a similar leadership position as an officer would probably be considered "work" even though the H-1B visa holder was not actually paid. Would an unpaid Board member? I think you can see the gray area.
In conclusion, the key factor is not just the acceptance of pay, it is what you are actually doing for the nonprofit that matters. Because so much is at stake for an H-1B visa holder, it would be wise to consult an immigration attorney first, then a nonprofit attorney second. Keep in mind with my response, my answer would be the same even if you were still working full-time for you H-1B visa sponsor. Working full-time (a 40-hour work week) for your H-1B sponsor certainly helps, but by itself it is still not enough to keep you out of trouble.