1. He spent two weeks in hospital.

2. He spent two weeks in the hospital.
(Are both the same in meaning?)

3. He has spent two weeks in hospital.
4. He has spent two weeks in the hospital.
(Are both the same in meaning?)

5. He has been in hospital for two weeks.
6. He has been in the hospital for two weeks.
(Are both the same in meaning?)

7. He has been at hopital for two weeks.
8. He has been at the hospital for two weeks.
(Are both the same in meaning? Can we use 'at' instead of 'in' as in #7 and #8.)

All are correct. People in the United Kingdom do not usually use an article before hospital. People in the United States usually use an article.

We use "at" to refer to someone visiting or working at a hospital. We use "in" to refer to patients in a hospital.