What age can a foster child leave a foster home?

When he has reached the legal age of majority in his state.