You have to live INSIDE the UK for a full 5 years on a qualifying visa in order to qualify for ILR. It doesn't matter how long you have been married for outside the UK, the 5-year clock to ILR does not start until you move to the UK on a spousal visa.
If you are the spouse of a UK citizen, your path to ILR is:
- 2.5 years on a UK spousal visa
- 2.5 years on a FLR(M) spousal visa extension
- ILR application after 5 years in the UK on the 2 spousal visas
If you are the spouse of an EEA citizen, you don't get ILR, you get Permanent Residence (PR):
- 6 months on EEA Family Permit
- 5 years on EEA Residence Card
- automatic PR after 5 years