Bonus shares are created from the reserves of the company. It's more of an accounting adjustment.
For a public company when a bonus share is issued for eg in the ratio 1:1 that would mean that those investors who are holding the shares of the company will get an additional share for every single share held.
When the shares are issued , the market capitalisation(No of shares* Share price) of the company remains the same. Now since the number of shares is doubles and the market cap remains the same, that would mean that the share price will be split in half. So there wont be an immediate advantage to an investor if they are given an bonus share but if the shares prices increases later, the investors profit can increase substantially.
For accounting purpose, the company's share capital is increased and reserve and surplus is reduced by the same amount in the Balance sheet.