Wi-fi doesn't work on my iPhone 4 If I do not have a SIM Card installed in my iPhone 4, will it still connect to the internet?

I have tried to connect via WiFi, it says that it is loading, yet doesn't connect.
I don't know if it has anything to do with the SIM Card because every time I try, it does not work and the message 'NO SIM CARD' shows up.
Absolutely. I personally still own an iPhone 4 and am using it to access the internet without the SIM card installed. The notification bar shows No Sim, which but this does not impact the device's WiFi.

The Common Fix: Resetting Network Settings
I would like you to try: Settings > General > Reset > Reset Network Settings

Which should clear up any issues by resettings the Network gear to their default settings. It has shown to be a common solution in the past. You will need to reconnect to your WiFi access point once the iPhone has restarted. Please report back with the status afterward.