Can typhoid spread from one person to the other through any medium? if so what are the measures that should be taken to avoid it from spreading?
Yes, typhoid is most certainly contagious. Indeed, one of the major figures in the history of public health, Mary Mallon (aka Typhoid Mary) is associated with this disease.
The only known hosts for Salmonella typhi, the causal organism for typhoid fever, are humans and higher primates, so it is definitely spread from person to person. This is primarily through the "fecal-oral route", wherein water or food contaminated with the bacteria from an infected individual's intestinal track is then ingested, proliferates, and causes illness.
In terms of preventing its spread, because of it's fecal-oral transmission route, the major methods are personal hygiene and sanitation. Hand washing, avoiding high risk foods (those that cannot be peeled, cooked throughly, etc.) are the usual steps to avoid enteric pathogens of all sorts. There is also a vaccine available, though it is not routinely administered in the United States nor heavily pushed by the WHO except in cases of "prolonged exposure to potentially contaminated food and water in high-risk areas", and does not provide complete protection.