I think the short answer to your question is YES, it can be done. The how factor is a bit more complicated probably, and depends on a lot of different factors, such as what type of iMac you have, and from what year, and so on.
Getting some kind of TV tuner, such as @lillycoyote described is probably one good option, but again you’ll have to get one that can be plugged in to your particular breed of iMac.
There may also be some kind of cables you can get, that will effectively transfer the signal, and interface with a program of some kind on your computer.
Again, it might be a bit complicated, and I’m not an iMac pro or anything, but if you’re simply wanting to know if it can be done, then YES, it can, and some research into the how is definitely worth-while.