It's possible because of VoIP API available on Windows Phone 8. It works on notifications, so you don't have to check if there is an incoming call - your app will be notified about one by the system.
Read more on MSDN: VoIP apps for Windows Phone 8.
Btw. there is no VoIP API on WP7/WP7.5 and that's why Skype on these systems works just terrible.