I am 59 years old I was married for 17 years divorced in 2000 my boyfriend is sick with with cancer and was thinking of getting married how long do I need to be married to get his ss and what is the percent thank u in advance
I'm sorry to hear about your boyfriend's illness.
You would likely need to be married to your boyfriend for at least 9 months in order to be able to qualify for widow's benefits on his record. There are exceptions to the 9 month duration of marriage requirement (https://www.ssa.gov/OP_Home/handbook/handbook.04/handbook-0404.html), but none of those are likely to apply if your husband dies due to an illness.
If you do end up qualifying for widow's benefits and you start drawing at full retirement age (FRA) or later, you could get up to your husband's full primary insurance amount (PIA) or his full benefit rate if he's drawing benefits at the time of his death. You couldn't draw that full amount plus your own benefit at the same time, though, just the higher of the two rates. You could potentially file for reduced widow's benefits as early as age 60, but in that case your rate would be reduced to 71.5% of your deceased husband's PIA.