Bought or bred just like any other livestock. A lot of zoo elephant calves have died due to elephant herpes which is a killer. Male elephants are the real issue since they often have special housing needs and mostly need to be kept alone.

Even in Thailand, a male elephant with an attitude is a very dangerous and difficult animal to house. One of the sanctuary males was was suspected of killing one of the founders of the sanctuary. So they had to send him north to a sanctuary who could handle his special needs. https://elephantsandtheirpeople.word...e-to-ideology/

Here the elephants are treated with no contact and protective barriers in sanctuaries.