Trouble getting bitbanged square wave/PWM to work

I've not worked out how the whole code works, but I can spot some things that may cause trouble:

unsigned int frequency=1;

That can't go down to 0.1Hz. You could make the units of frequency 0.1Hz and when you want to convert frequency to a time period in ms multiply by 100 instead of 1000.

frequency=frequency-1;

You don't have a check to limit the minimum value to 1.

  hightime = (1/frequency)*1000*pulsewidth/100; //convert Hz to ms to get the period and then multiply it by the pulse width as a percentage to get "high" time
  lowtime = ((1/frequency)*1000)-hightime; // period - "high" time = "low" time.

Those calculations aren't going to work with integers. I just quickly googled and found this https://www.cs.mtsu.edu/~xyang/2170/typeConversion.html there may be a better guide somewhere in this forum.

No problem for one day.

    if (millis() - prMillis >= hightime)

That's the correct way to do it, even if millis() rolls over back to 0 that will work. See Using millis over long time - #2 by marco_c