The law will vary from state to state. You can do "your" own pest control at your home. You can not do pest control for someone else and charge them for the service. You doing pest control for a friend and not charging for the service is a bit of a murky area.
The fact is that a lot of property owners have their maintenance guys spray for bugs in rental properties. I see it all the time and I can not recall ever hearing about anyone getting into legal trouble. But, if someone was poisoned due to chemicals, you would probably be held accountable as the owner.
That is why most states require training and liability insurance to obtain a Pest control applicators license.
Think about this: If you need to treat a unit and it will require the tenant to be out of the apartment for a couple of hours, you may want to hire a licensed pest control company for the job. I frequently advise maintenance guys on my multi unit accounts on how to take care of minor roach and mice problems. They call me in when they need me for something more involved.