The main way and cause of people getting tapeworms is through eating undercooked meat that contains the tapeworm parasite.
The meat that is not fully cooked can contain the tapeworms and then when you ingest that meat then you get those tapeworms yourself.
Cows and other animals who graze on grass and fields can ingest tapeworms from the grass they eat.
Then the meat can become infected with the tapeworms which can be transferred to humans when they eat the meat that is not fully cooked.
A human may also get tapeworms from contaminated water.
It's rare that humans get tapeworms but when it does occur the tapeworm usually goes away on it's own but still it's good to get de worm medicine from your doctor get rid of the tapeworm in your body.