When the tourist visa denial is based upon a possible intent to immigrate (also known as INA Section 214(b) denial), it CAN be a problem for student visa.
Typically, medical treatment in the USA is undertaken on a B-1 ("Business" visa. Strange, huh?). But do not get confused. Consulates often mark visas as B-1/B-2 or even B-2 (visitors/tourist) for medical treatment. Once here, you can ask for extensions of stay if the circumstances so require. I remember extending the stay of a child and his parents for two years (in 6-monthly chunks), where the baby was being treated for ongoing medical problems.
Discussing allegations of fraud and consequences when a short term visa holder tries to convert to green card or another long term visa from within the US.