Since the financial crisis of 2008-9, banks have become less willing to lend to each other for periods of more than one day. They prefer to lend `overnight', and must do this at the overnight (O/N) rate which changes each day. However, if they wish to lend for periods of days, weeks or even months, the lender (and borrower) have to repeat the O/N deposit for every day of the period. Both borrower and lender are subject to the risk that the O/N rate will change.
There are different overnight rates for each currency. In the UK, the Sterling Overnight Interbank Average Rate (SONIA) is used. This is an index calculated based on the average rate of unsecured overnight sterling transactions brokered by the Wholesale Market Brokers Association. Transactions must have a size greater than 25 Million GBP. In the US the equivalent index is the Fed Funds rate and in the Eurozone it is ESTER rate. ESTER, Federal funds and SONIA are unsecured rates.
The purpose of OIS swaps is to allow banks to lock-in the cost of secured or unsecured overnight funding in advance. At the start of the lending period, the bank buys an OIS which will mature when the period of lending is to end. At the end of the lending period, the bank holds the rolled-up balance of all of the O/N reinvestments of the initial sum lent which it has just received back from the borrower. The OIS matures at this time. This amount held by the lending bank is identical to what the lender has to pay on one leg of the OIS. On the other leg the bank receives a fixed interest rate on the initial sum. This fixed rate is the OIS rate and it was set at the beginning of the OIS. The bank lender locked in this rate. OIS are not just for lenders. A borrower can also use an OIS to hedge their overnight rate risk.
The OIS rate reflects the market's expectation of the cost of repeated overnight unsecured lending over periods of up to two weeks (sometimes more). Whether it is secured or not depends on which of the overnight rates it is linked to. Because it is based on overnight lending, it is assumed to have a lower credit risk than longer term interbank loans based on say 1M, 2M or 3M Libor and this is what drives the OIS-Libor spread. The OIS swap rate is the market's expectation of what the compounded daily (geometric average) index rate will be over the lifetime of the OIS.
In USD the index rate is the fed funds rate which sets the cost of unsecured lending. In Euros the unsecured lending rate is set by EONIA and in Sterling it is called SONIA where ONIA stands for overnight index rate. However, more recent overnight indices like the USD-denominated SOFR are based on secured lending.
Finally, your confusion may be due to the use of OIS for discounting of collateralised non-cleared derivatives. This has been a market practice since 2008. The OIS rate is used because it is close to the typical interest rate paid on the collateral that is held. It becomes the best estimate of the risk-neutral, risk-free rate in a world where the collateral has effectively eliminated counterparty risk.