If some disease is contagious doesa that mean it has to be caused by a bacteria or virus?

Both are possible. Both bacteria and viruses can be contagious. Always practice good hygiene. Washing you hands is the best prevention. Wishing you the best.