When applicable, immediate family members can enter the U.S. on a dependent visa along with a foreign worker. This depends on the class of work visa of a main applicant. The spouse and children (generally under 21 and not married) can obtain a derivative visa to live in the U.S. as long as the primary holder is in the U.S.
H-1B spouse and children can apply for H-4 visa, so yes, H-4 dependents are allowed to study in the U.S. but not able to work unless the H-4 spouse has been issued an employment authorization document (EAD) because his/her H-1B visa holder spouse is in the process of applying for a green card.
With an L-2 visa, your spouse and children of L-1 visa holders can accompany them. Unlike H-4 visa owner, L-2 partners can work without getting work approved separately in country. Family members of O-1 visa holders can apply for an O-3 visa (O-3 visa holders cannot work)
Likewise, dependents can apply for a TD visa accompanying other work visa categories, such as TN visas for Canadian and Mexican professionals under NAFTA/USMCA (but the TD cannot work in the United States), and S holder (for treaty traders and investors) may bring a dependent on an E-2 or E-3 but generally, the spouse is able to work.
Petitioners must keep their status in all such cases, and in some vases, dependents would need to submit extension & renewal applications in the event the primary Visa holder extends his or her work Visa. In cases where the main visa holder transfers or changes to another category or loses status, dependents are likely to be affected too.

